View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Doug Glancy Doug Glancy is offline
external usenet poster
 
Posts: 770
Default Go to lastrow using other column's lastrow

Tom,

NoI was trying to respond to what seems to be the OP's specification of
using Worksheet "A" both in the specification of last_row and in the Select.
I see now that it doesn't work if Activecell is in other than Worksheet "A".
Don't know if OP really wants to always go to "A", but if so, how's this?

Sub test()

Dim last_row As Long

last_row = Worksheets("A").Range("G" & Rows.Count).End(xlUp).Row
Application.Goto reference:=Worksheets("A").Cells(last_row,
ActiveCell.Column)

End Sub


Doug

"Tom Ogilvy" wrote in message
...
more consistent would be

Sub test()

Dim last_row As Long

last_row = Range("G" & Rows.Count).End(xlUp).Row
Cells(last_row, ActiveCell.Column).Select

End Sub

Unless you want to base the last row on a sheet other than the active

sheet.

--
Regards,
Tom Ogilvy


"Doug Glancy" wrote in message
...
stakar,

This will select the cell that's in the same column as the current

selection
and the same row as the last used row in column G:

Sub test()

Dim last_row As Long

last_row = Worksheets("A").Range("G" & Rows.Count).End(xlUp).Row
Worksheets("A").Cells(last_row, ActiveCell.Column).Select

End Sub

hth,

Doug

"stakar " wrote in message
...
i have the following problem
I want to use the column's G lastrow and go to the lastrow of the
worksheet("A") activecolumn using a macro

Be more specific

last_row = Worksheets("A").Range("G65536").End(xlUp).Row

Using the last_row i want to go to the last_row of the activecolumn.
So if the last_row =120 and the activecolumn is "B" i want to go to

the
cell 'B120'

Thanks in advance
Stathis


---
Message posted from http://www.ExcelForum.com/