Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select upto last available Row
Hi
I am using below function to select fix range, how can I change "100" with a variable, so it select from "A2" upto last row which have entry. Range("A2:AN100").Select Regards |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select upto last available Row
Assuming you mean the last row in Column A thru N with a formula or constant
value in it... LastRow = Range("A:AN").Find(What:="*", SearchOrder:=xlRows, _ SearchDirection:=xlPrevious, LookIn:=xlFormulas).Row Range("A2:AN" & LastRow).Select Change the xlFormulas to xlValues if you want have only constant values in your cells or, if there are formulas in them, if you want to ignore formulas that evaluate to the empty string (""). -- Rick (MVP - Excel) "Atif" wrote in message ... Hi I am using below function to select fix range, how can I change "100" with a variable, so it select from "A2" upto last row which have entry. Range("A2:AN100").Select Regards |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select upto last available Row
Dim myRange as Excel.Range
Dim aWS as Excel.Worksheet Dim lRow as long Set aWS = ActiveSheet Set myRange = aWS.Range("A2") lRow = aWS.Cells(aWS.Rows.Count,myRange.column).end(xlup) .row Set myRange = myRange.resize(lrow - myrange.row + 1, 1) myRange.Select HTH, Barb Reinhardt "Atif" wrote: Hi I am using below function to select fix range, how can I change "100" with a variable, so it select from "A2" upto last row which have entry. Range("A2:AN100").Select Regards |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
To execute a formula upto in a cell | Excel Discussion (Misc queries) | |||
adding cells upto and including a specified cell | Excel Discussion (Misc queries) | |||
Convert a number upto 100 to binary | Excel Programming | |||
formula to round up any number less than 35 upto 35. | Excel Discussion (Misc queries) | |||
cell with highest value g5 would be upto 80=1,81:160=1.5, | Excel Programming |