ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Go to lastrow using other column's lastrow (https://www.excelbanter.com/excel-programming/295195-go-lastrow-using-other-columns-lastrow.html)

stakar[_14_]

Go to lastrow using other column's lastrow
 
i have the following problem
I want to use the column's G lastrow and go to the lastrow of th
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 th
cell 'B120'

Thanks in advance
Stathi

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


Frank Kabel

Go to lastrow using other column's lastrow
 
Hi
try
LastRow = ActiveSheet.Cells(Rows.Count,
activecell.column).End(xlUp).row

or
ActiveSheet.Cells(Rows.Count, activecell.column).End(xlUp).select
--
Regards
Frank Kabel
Frankfurt, Germany


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/



Doug Glancy

Go to lastrow using other column's lastrow
 
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/




Tom Ogilvy

Go to lastrow using other column's lastrow
 
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/






Doug Glancy

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/








stakar[_15_]

Go to lastrow using other column's lastrow
 
Thanks a lot!!
All replies are just perfect for my problem!!


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



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

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