MACROS

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Chick

Use the End property

Range("A1", Range("A1").End(xlDown)).Select
 
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top