Hi all,
I want to copy a range of data from one worksheet, and paste it into another worksheet. The worksheet it will be pasted into should be specified by the user. I'm trying to do this by using an inputbox where the user can enter the name of the worksheet he/she would like the data pasted into. This is the code I have so far.
I set sheetName as an integer variable because the names of the worksheets that the data can be pasted into are 1-31. (Representing Days of the month)
I don't think I'm referencing the variable correctly though. I'm new to VBA, I'd appreciate any help.
Sub Data()
Dim sheetName As Integer
Application.ScreenUpdating = False
Range("DataEntry").Copy
sheetName = InputBox("Please enter current day of the month", sheetName)
Worksheets("sheetName").Range("a1:z600").PasteSpecial Paste:=xlPasteValues
End Sub
I want to copy a range of data from one worksheet, and paste it into another worksheet. The worksheet it will be pasted into should be specified by the user. I'm trying to do this by using an inputbox where the user can enter the name of the worksheet he/she would like the data pasted into. This is the code I have so far.
I set sheetName as an integer variable because the names of the worksheets that the data can be pasted into are 1-31. (Representing Days of the month)
I don't think I'm referencing the variable correctly though. I'm new to VBA, I'd appreciate any help.
Sub Data()
Dim sheetName As Integer
Application.ScreenUpdating = False
Range("DataEntry").Copy
sheetName = InputBox("Please enter current day of the month", sheetName)
Worksheets("sheetName").Range("a1:z600").PasteSpecial Paste:=xlPasteValues
End Sub