Macro to Select last sheet with data in a workbook

jmh1

New Member
Joined
Aug 4, 2005
Messages
43
How can i write a macro that will paste data into the last sheet with data in a workbook? I have a workbook with 31 sheets (1 for each day of the month) and everyday i want to paste data into the sheet for that day. paste into sheet 1 on the 1st, 2 on the 2nd, etc..

How can i write a macro that will automate that process?
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
How about something like this:
Code:
Sub dates()

Dim MyStr As Integer

MyStr = Format(Now, "dd")
Sheets("Sheet" & MyStr).Select

End Sub
If the sheets are named Sheet1, Sheet2,...,Sheet31:
When the macro is run, if it is December 22, Sheet22 will be selected.

I dont know where or what you will be pasting, but that code will have to be added at the end of this code.
 
Upvote 0

Forum statistics

Threads
1,215,734
Messages
6,126,543
Members
449,316
Latest member
sravya

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