MACROS

C

CHICK1

H
How do I make a macro that selects all the populated cells in a row? I have tried recording the macro by pressing end, shift and the down arrow, but this results in the same number of cells being selected as there were in the dummy file that i used to make the macro. I want the macro to select a variable number of cells each time i use it
Thanks
 
J

Jim Rech

To start with the active cell rather than A1 you could use this modification
of Dick's code:

Range(ActiveCell, ActiveCell.End(xlDown)).Select

--
Jim Rech
Excel MVP
| Hi
| How do I make a macro that selects all the populated cells in a row? I
have tried recording the macro by pressing end, shift and the down arrow,
but this results in the same number of cells being selected as there were in
the dummy file that i used to make the macro. I want the macro to select a
variable number of cells each time i use it.
| Thanks
 
D

David McRitchie

to the original poster,
I think you have mixed up the words "row" and "column"
but since you said you used the down arrow, it looks
like you meant column.

If you did not get the answer you were looking for
my interpretation was that you only wanted populated
cells (non empty) cells in a row (or is that column).

You might take a look at use of SpecialCells,
unfortunately you can't do constants and formulas
for non Blanks in one-shot. And you can't easily
combine the results either such as if one set is empty.
 
Top