VBA TO COPY DATA TO NEXT SHEET!

SouthernGent0327

New Member
Joined
Jan 30, 2021
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Good Afternoon,

I have a workbook which opens to a userform for the user to enter name and year. Once entered the submit button copies a master sheet for 12 months with the entered year and hides the master sheet. My problem is I need a macro which can copy data from a cell on the ActiveSheet (which ever month it may be to the very next month) in a different cell. Since the worksheet tab names always change I have tried to reference the sheet code name in the following manner:

VBA Code:
Sub TransferData()

If ActiveSheet = Sheet3 Then
    Sheet3.Range("J16").Copy
    Sheet4.Activate
    Sheet4.Range("J15").xlPasteValues
End If

End Sub

This code generates Object Doesn't Support Error and I am not sure why. My thought was I would just create this same code for each sheet with a button to transfer data to the next sheet, but I can't figure out how to accomplish this task. Please help!! Thanks in advance.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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