Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using an offset formula for the reference in a relative reference Cuda Excel Worksheet Functions 6 November 15th 06 05:12 PM
Relative Reference liseladele Excel Programming 2 April 28th 06 08:29 PM
Relative reference Lakebum Excel Worksheet Functions 2 December 28th 04 05:57 PM
Relative Reference Barry Givens via OfficeKB.com Excel Discussion (Misc queries) 3 December 17th 04 07:31 PM
Go to lastrow using other column's lastrow stakar[_14_] Excel Programming 5 April 16th 04 03:42 PM


All times are GMT +1. The time now is 09:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"