relative reference for LastRow

  • Thread starter Thread starter Matt S
  • Start date Start date
M

Matt S

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
 
oh my gosh that's so simple. I'm gonna go cry in a corner now.

THANKS SO MUCH!
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top