Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
lastrow question
have text in rows 61 and 62 and i want the lastrow before that (45). i know
i can start at the top and go down, but i want to do this. anyway sLastRow = .Cells(Rows.Count, "B").End(xlUp).Row ' gives me 62 sLastRow = .Cells(Rows.Count, "B").End(xlUp)(3).Row 'gives me 64 sLastRow = .Cells(Rows.Count, "B").End(xlUp).End(xlUp).End(xlUp).Row 'gives me 45, which is what i want why doesn't the 2nd one work? -- Gary |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
lastrow question
Hi Gary,
sLastRow = .Cells(Rows.Count, "B").End(xlUp)(3).Row 'gives me 64 The expression is eqiuvalent to: sLastRow = .Cells(Rows.Count, "B").End(xlUp).Cells.Item(3).Row or sLastRow = .Cells(Rows.Count, "B").End(xlUp).Offset(2).Row --- Regards, Norman "GKeramidas" wrote in message ... have text in rows 61 and 62 and i want the lastrow before that (45). i know i can start at the top and go down, but i want to do this. anyway sLastRow = .Cells(Rows.Count, "B").End(xlUp).Row ' gives me 62 sLastRow = .Cells(Rows.Count, "B").End(xlUp)(3).Row 'gives me 64 sLastRow = .Cells(Rows.Count, "B").End(xlUp).End(xlUp).End(xlUp).Row 'gives me 45, which is what i want why doesn't the 2nd one work? -- Gary |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
lastrow question
thanks for the explanation norman. so, is the way i have it return 45 the
best way, then? -- Gary "Norman Jones" wrote in message ... Hi Gary, sLastRow = .Cells(Rows.Count, "B").End(xlUp)(3).Row 'gives me 64 The expression is eqiuvalent to: sLastRow = .Cells(Rows.Count, "B").End(xlUp).Cells.Item(3).Row or sLastRow = .Cells(Rows.Count, "B").End(xlUp).Offset(2).Row --- Regards, Norman "GKeramidas" wrote in message ... have text in rows 61 and 62 and i want the lastrow before that (45). i know i can start at the top and go down, but i want to do this. anyway sLastRow = .Cells(Rows.Count, "B").End(xlUp).Row ' gives me 62 sLastRow = .Cells(Rows.Count, "B").End(xlUp)(3).Row 'gives me 64 sLastRow = .Cells(Rows.Count, "B").End(xlUp).End(xlUp).End(xlUp).Row 'gives me 45, which is what i want why doesn't the 2nd one work? -- Gary |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
lastrow question
Hi Gary,
thanks for the explanation norman. so, is the way i have it return 45 the best way, then? Subject to your data configuration, your method is fine! --- Regards, Norman |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
lastrow question
ok, thanks again
-- Gary "Norman Jones" wrote in message ... Hi Gary, thanks for the explanation norman. so, is the way i have it return 45 the best way, then? Subject to your data configuration, your method is fine! --- Regards, Norman |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Lastrow | Excel Worksheet Functions | |||
Lastrow | Excel Worksheet Functions | |||
LastRow of Data | Excel Worksheet Functions | |||
Go to lastrow using other column's lastrow | Excel Programming | |||
Help with LastRow | Excel Programming |