G
Guest
In short I'm trying to set up a macro so that a spreadsheet full of data (4
or 5 colums) can be copied and pasted into a user details worksheet. Once
copied I will run the macro, which will create, name, and populate a new
worksheet in the same workbook. My first attempt is below;
Range("A3").Select
Selection.Copy
Sheets.Add
Sheets("Sheet2").Select
Sheets("Sheet2").Name = "PID1"
Sheets("Template").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("PID1").Select
Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
ActiveSheet.Paste
Sheets("User Details List").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("PID1").Select
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveSheet.Paste
Sheets("User Details List").Select
ActiveCell.Offset(0, 1).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("PID1").Select
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
Sheets("User Details List").Select
ActiveCell.Offset(0, 1).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("PID1").Select
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
Sheets("User Details List").Select
ActiveCell.Offset(0, 1).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("PID1").Select
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
Sheets("User Details List").Select
ActiveCell.Offset(0, 1).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("PID1").Select
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
Sheets("User Details List").Select
ActiveCell.Offset(0, 1).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("PID1").Select
ActiveWindow.SmallScroll ToRight:=1
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
End Sub
It doesn't seem to be iterative or relative to fields it has already used.
I ran the macro and it created an error.
Any help would be very much appreciated
Many Thanks
Richard
or 5 colums) can be copied and pasted into a user details worksheet. Once
copied I will run the macro, which will create, name, and populate a new
worksheet in the same workbook. My first attempt is below;
Range("A3").Select
Selection.Copy
Sheets.Add
Sheets("Sheet2").Select
Sheets("Sheet2").Name = "PID1"
Sheets("Template").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("PID1").Select
Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
ActiveSheet.Paste
Sheets("User Details List").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("PID1").Select
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveSheet.Paste
Sheets("User Details List").Select
ActiveCell.Offset(0, 1).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("PID1").Select
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
Sheets("User Details List").Select
ActiveCell.Offset(0, 1).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("PID1").Select
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
Sheets("User Details List").Select
ActiveCell.Offset(0, 1).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("PID1").Select
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
Sheets("User Details List").Select
ActiveCell.Offset(0, 1).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("PID1").Select
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
Sheets("User Details List").Select
ActiveCell.Offset(0, 1).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("PID1").Select
ActiveWindow.SmallScroll ToRight:=1
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
End Sub
It doesn't seem to be iterative or relative to fields it has already used.
I ran the macro and it created an error.
Any help would be very much appreciated
Many Thanks
Richard