ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   selecting a range of cells (https://www.excelbanter.com/excel-programming/324629-selecting-range-cells.html)

Grandma Barb[_3_]

selecting a range of cells
 
I am working in VBA and am still trying to select ranges.

This statement works to select all the rows that are used
in columns A to C
Set rng = Range("A1:C" & Cells(Rows.Count, "C").End
(xlUp).Row)
rng.Select

I am trying to select all the rows from 3 on down in
columns N and O. This does not work as it only gets
through row 32. What am I missing?

Set rng = Range("N3:O3" & Cells(Rows.Count, "O").End
(xlUp).Row)
rng.Select


GaryDK

selecting a range of cells
 
Barb,

Try changing:

Set rng = Range("N3:O3" & Cells(Rows.Count, "O").End(xlUp).Row)

to

Set rng = Range("N3:O" & Cells(Rows.Count, "O").End(xlUp).Row)

Gary



All times are GMT +1. The time now is 05:07 PM.

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