SouthernGent0327
New Member
- Joined
- Jan 30, 2021
- Messages
- 14
- Office Version
- 365
- Platform
- 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:
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.
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.