VBA: Open workbook to last empty row

bamaisgreat

Well-known Member
Joined
Jan 23, 2012
Messages
831
Office Version
  1. 365
Platform
  1. Windows
I have a workbook named "Archive" and a sheet named "Master" which I would like for It to go to the last empty row upon opening. Is there away to do this...Thanks
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Open the VBE editor Alt+F11

Open ThisWorkbook module.
Click on drop down menu to "Workbook"
It should create the procedure:

Private Sub Workbook_Open()


End Sub

Write this code in the procedure:
dim rng as range
dim wks as worksheet
set wks=thisworkbook.worksheet("Master")
wks.select
set rng=wks.range("A" & application.rows.count)
rng.end(xlup).offset(1).select

This hasn't been verified but is should work!
 
Upvote 0
Did you remember to put in the "set" keyword?

It should be:
set wks=thisworkbook.worksheet("Master")
 
Upvote 0
yes, the error Compile error: Method of Data member not found
then it highlights the bold area
Private Sub Workbook_Open()
Dim rng As Range
Dim wks As Worksheet
Set wks = ThisWorkbook.Worksheet("Sheet1")
wks.Select
Set rng = wks.Range("A" & Application.Rows.Count)
rng.End(xlUp).Offset(1).Select

End Sub
 
Upvote 0
Hi all

Give this a try:

Private Sub Workbook_Open()
Sheets(1).Select
Range("A65536").End(xlUp).Offset(1, 0).Select
End Sub


You may change sheets number and column as necessary

ColdGeorge
 
Upvote 0
Sorry, I should have tested it first for you, or at least written it in the VBE (sometimes I like to think I know it all :) ).

"Worksheet" should be "Worksheets"
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

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
Back
Top