ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   relative reference for LastRow (https://www.excelbanter.com/excel-programming/426972-relative-reference-lastrow.html)

Matt S

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

Dave Peterson

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

Matt S

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


Matt S

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


Dave Peterson

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


All times are GMT +1. The time now is 07:27 AM.

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