ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I select this range using code? (https://www.excelbanter.com/excel-programming/287886-how-do-i-select-range-using-code.html)

TBA[_3_]

How do I select this range using code?
 
Excel 2000
Windows 2k Pro


My StartCell is Range("B4").

My LastCell will be Range("E?") where the ? represents the last row
containing a value in either columns B through E.

-gk-




John Wilson

How do I select this range using code?
 
TBA,

Try this out:

range(range("B4"), Range("E" & Range("B4").CurrentRegion.Rows.count)).select

John

"TBA" wrote in message
...
Excel 2000
Windows 2k Pro


My StartCell is Range("B4").

My LastCell will be Range("E?") where the ? represents the last row
containing a value in either columns B through E.

-gk-






Per Erik Midtrød

How do I select this range using code?
 
Although I am pretty sure someone comes up with a better way:
Sub SelectColumnE()
Dim B, E As Integer

Range("b65536").Select
Selection.End(xlUp).Select
B = Selection.Row

Range("e65536").Select
Selection.End(xlUp).Select
E = Selection.Row

If B = E Then Range("e" & B).Select
If B < E Then Range("e" & E).Select

End Sub

Per Erik

On Wed, 14 Jan 2004 10:51:03 -0600, "TBA"
wrote:

Excel 2000
Windows 2k Pro


My StartCell is Range("B4").

My LastCell will be Range("E?") where the ? represents the last row
containing a value in either columns B through E.

-gk-





All times are GMT +1. The time now is 03:02 AM.

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