![]() |
Moving right in a macro
Want to highlight a cell (for example A7), highlight it with a background
colour, move right one cell, highlight it with a background colour, move right one cell, highlight it - for a total of 15 cells. If I do this by recording a macro, when I run the macro from cell A15, the macro highlights A15 then moves to B7 not B15. How can I accomplish highlighting a continguous range of 15 horizontal cells? |
All the same color?
If yes, you could get all 15 cells with something like: ActiveCell.Resize(1, 15).Interior.ColorIndex = 3 BJS wrote: Want to highlight a cell (for example A7), highlight it with a background colour, move right one cell, highlight it with a background colour, move right one cell, highlight it - for a total of 15 cells. If I do this by recording a macro, when I run the macro from cell A15, the macro highlights A15 then moves to B7 not B15. How can I accomplish highlighting a continguous range of 15 horizontal cells? -- Dave Peterson |
BJS,
The macro recorder was not set to relative mode, so it went to the absolute cell. Record the macro again. In the Stop Recording toolbar (View - Toolbars), make sure the relative button is lit. You will want to have selected the starting cell before you start the recorder, or it will record that move. Or you could use the existing macro. Move right with Activecell.offset(0,1).select -- Earl Kiosterud www.smokeylake.com "BJS" wrote in message ... Want to highlight a cell (for example A7), highlight it with a background colour, move right one cell, highlight it with a background colour, move right one cell, highlight it - for a total of 15 cells. If I do this by recording a macro, when I run the macro from cell A15, the macro highlights A15 then moves to B7 not B15. How can I accomplish highlighting a continguous range of 15 horizontal cells? |
All times are GMT +1. The time now is 02:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com