Hello
I have an activity where I need to create a new workbook, copy data from it and paste back to actual workbook. Before moving back to source workbook, I need to allow user to make some changes with the newly created workbook ie wb2.
Below are the code I use;
Please advise.
Many thanks in advance.
I have an activity where I need to create a new workbook, copy data from it and paste back to actual workbook. Before moving back to source workbook, I need to allow user to make some changes with the newly created workbook ie wb2.
Below are the code I use;
Code:
Dim ctl As Control
Dim RowCount As Long
Dim myPath As String
Dim wb2 As Workbook
Application.ScreenUpdating = False
Set wb2 = Workbooks.Add
wb2.Activate
With ActiveSheet.Range("A1")
ActiveCell.PasteSpecial
End With
Unload Me
Dim n As Integer, rng As Range
'n = InputBox("type the value of n")
Set rng = Range("A1:AN1")
rng.Select
line2:
n = InputBox("Total number of entries?")
Range(rng.Offset(1, 0), rng.Offset(n, 0)).EntireRow.Insert
Range(rng, rng.End(xlToRight)).Copy
Range(rng, rng.Offset(n, 0)).PasteSpecial
Set rng = rng.Offset(n + 1, 0)
Range("a1").Select
Columns("A:AN").EntireColumn.AutoFit
Application.ScreenUpdating = True
wb2.Activate
Please advise.
Many thanks in advance.