Macro to enter text into selected cell range

Common problems – different language?
Let's talk in English.

Macro to enter text into selected cell range

Poslaťod Palo-admin » 18.09.2009, 08:34

Rod Palmer posted
I have an excel spreadsheet to organize a shift roster. I need a macro that will fill the selected cell range with specific text. For example; the crews names are listed down in column A, the rows to the left are the days of the month, if a person is has a seven day roster of night shift, I want to select seven cells and press a button that will fill the cells with the letter 'N'.

You need no macro to do it.
Just simple select range of cells, type "N" to first one of selected cells and press CTRL+ENTER

Macro is useful, when you need to run specific action, e.g.
enable entering data in cell and in the same time let cell to be recalculated.

See sample:

Thanks Palo
Your solution does work, but I guess I was just trying to be a bit lazy. I have a tool bar that I created that will shade the selected cell range to indicate Day shift, Night shift, Fly In, Fly Out, Annualy Leave, etc. But I wanted to adapt the macros for this to also drop in the abbreviations (D, N, FI, FO, AL,etc).

To avoid misunderstanding adding link to your solution here should be useful.
Anyway, you can add to your macros (attached to tool bar buttons) simply code row like this:

Kód: Vybrať všetko
Selection.Value = "N"

If you need to identify, which tool bar button was pressed, try this examlee: ... Button.xls

Rod Palmer
Thanks Palo - It is all working fine now - thanks again.
Administrátor stránky
Príspevky: 473
Registrovaný: 18.07.2008, 16:43
Udelené poďakovania: 6 krát
Prijaté poďakovania: 63 krát

Späť na Solving MS Office problems in English

Kto je on-line

Užívatelia prezerajúci fórum: Žiadny registrovaný užívateľ nie je prítomný a 1 hosť