Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
relative reference for LastRow
All,
I am trying to find out the last row of the column that I am currently residing. I believe the following code only looks at column A. How can I modify it for the column I have selected? LastRow = Cells(Rows.Count, "A").End(xlUp).Row Thanks!!!! Matt |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
relative reference for LastRow
LastRow = Cells(Rows.Count, activecell.column).End(xlUp).Row
Matt S wrote: All, I am trying to find out the last row of the column that I am currently residing. I believe the following code only looks at column A. How can I modify it for the column I have selected? LastRow = Cells(Rows.Count, "A").End(xlUp).Row Thanks!!!! Matt -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
relative reference for LastRow
oh my gosh that's so simple. I'm gonna go cry in a corner now.
THANKS SO MUCH! "Dave Peterson" wrote: LastRow = Cells(Rows.Count, activecell.column).End(xlUp).Row Matt S wrote: All, I am trying to find out the last row of the column that I am currently residing. I believe the following code only looks at column A. How can I modify it for the column I have selected? LastRow = Cells(Rows.Count, "A").End(xlUp).Row Thanks!!!! Matt -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
relative reference for LastRow
Dave,
What's wrong with this transposing? Thanks, Matt LastRow = Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row ReDim arrTop(1 To 11, 1 To LastRow) StartingRow = 18 EndingRow = 36 Application.Transpose(arrTop) = ActiveCell.Range("B" & StartingRow & ":L" & EndingRow).Value "Dave Peterson" wrote: LastRow = Cells(Rows.Count, activecell.column).End(xlUp).Row Matt S wrote: All, I am trying to find out the last row of the column that I am currently residing. I believe the following code only looks at column A. How can I modify it for the column I have selected? LastRow = Cells(Rows.Count, "A").End(xlUp).Row Thanks!!!! Matt -- Dave Peterson |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
relative reference for LastRow
I think you want to use the transpose on the right hand side and use
activesheet.range("b"... and using LastRow vs EndingRow will break things, too. But if you are trying to pick up a range of cells and put it into an array, then this is easier: If yes, then something like this is easier: Dim ArrTop As Variant Dim Lastrow As Long Dim StartingRow As Long With ActiveSheet Lastrow = .Cells(.Rows.Count, ActiveCell.Column).End(xlUp).Row StartingRow = 18 ArrTop = .Range("B" & StartingRow & ":L" & Lastrow).Value 'or if you want it transposed... ArrTop _ = Application.Transpose(.Range("B" & StartingRow & ":L" & Lastrow).Value) End With Matt S wrote: Dave, What's wrong with this transposing? Thanks, Matt LastRow = Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row ReDim arrTop(1 To 11, 1 To LastRow) StartingRow = 18 EndingRow = 36 Application.Transpose(arrTop) = ActiveCell.Range("B" & StartingRow & ":L" & EndingRow).Value "Dave Peterson" wrote: LastRow = Cells(Rows.Count, activecell.column).End(xlUp).Row Matt S wrote: All, I am trying to find out the last row of the column that I am currently residing. I believe the following code only looks at column A. How can I modify it for the column I have selected? LastRow = Cells(Rows.Count, "A").End(xlUp).Row Thanks!!!! Matt -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using an offset formula for the reference in a relative reference | Excel Worksheet Functions | |||
Relative Reference | Excel Programming | |||
Relative reference | Excel Worksheet Functions | |||
Relative Reference | Excel Discussion (Misc queries) | |||
Go to lastrow using other column's lastrow | Excel Programming |