Cursor placement by macro

Rick37

New Member
Joined
Feb 29, 2016
Messages
23
Hi I am a novice at vba. I am using Excel 2010. I have a workbook with 4 worksheets with sports results and I want the cursor to be left at the last row of data, at column A on each sheet. I found a piece of code to find the last row number:

Dim lastrow As Long
lastrow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
MsgBox lastrow

Produces the correct row number for one sheet. I am trying to use this to place the cursor but can't add the column name to it.

Can this even be done?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
18,711
Office Version
  1. 2013
Platform
  1. Windows
Try this:
Code:
Sub Goto_Last_Cell()
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 1 To Sheets.Count
        Lastrow = Sheets(i).Cells(Rows.Count, "A").End(xlUp).Row
        Application.Goto Sheets(i).Cells(Lastrow, 1)
    Next
Application.ScreenUpdating = True
End Sub
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,149
Messages
5,835,683
Members
430,376
Latest member
eeehhhyyy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top