lezawang
Well-known Member
- Joined
- Mar 27, 2016
- Messages
- 1,805
- Office Version
- 2016
- Platform
- Windows
Hi
I have 2 workbooks are open. Workbooks(1) and Workbooks(2). The code and the button to run the code are in workbooks(1). The code below does not work after I entered the following
x= 1
y = 1
z =2
m = 1
Any idea why? thank you very much.
I have 2 workbooks are open. Workbooks(1) and Workbooks(2). The code and the button to run the code are in workbooks(1). The code below does not work after I entered the following
x= 1
y = 1
z =2
m = 1
Code:
Sub ws_copy_to_different_wb()
Dim x As Integer
Dim y As Integer
Dim z As Integer
x = InputBox("workbook #")
y = InputBox("worksheet #")
z = InputBox("destination book")
m = InputBox("after which sheet in destination")
Workbooks(x).Worksheets(y).Copy after:=Workbooks(z).Worksheets(m)
End Sub
Any idea why? thank you very much.
Last edited: