ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selection.End(xlDown) with Rows selected (https://www.excelbanter.com/excel-programming/274685-selection-end-xldown-rows-selected.html)

norman

Selection.End(xlDown) with Rows selected
 
Hello Karen.
I might be missing something, but if you 'select' 1:1,
then use 'selection' in a formula, it starts with the
cell selected (1:1) not the one activated.

The following code will hunt back from the end (or
whatever parameter you use) to the last row in a range.
Set rngZipCodes = Range(Range("a2"), Range("a65536").End
(xlUp)).

Just substitute A2 for N1 and a65536 for a row beyond the
end of the range.

Norman


-----Original Message-----
Hello - haven't been on this group in years, but I just
came across a problem, and I'm not sure if the syntax

has
changed since older versions of Excel, but I can't make
this work. I'm attempting to select row 1, make N1 the
active cell, and then select down through the range

(thus
choosing all the rows in the range, but using column N

as
the active column). When I do the following code, it

uses
A as the active row and, ultimately, the entire range is
not selected:

Rows("1:1").Select
Range("N1").Activate
Range(Selection, Selection.End(xlDown)).Select

I thought about choosing just N1, selecting the range
down, and then selecting all the rows, but I can't make
that work for a dynamic range (i.e. without it choosing
specifically the number of rows I have in the example

I'm
using through the macro recorder). I'm admittedly not

the
most proficient programmer, but I remember I used to

know
how to manually adjust for this, and it either slipped

my
memory or that syntax has changed. Probably the

former...

Any help would be most appreciated!

Thanks,
Karen

.



All times are GMT +1. The time now is 09:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com