Example :
Below code will copy data from sheet1 to sheet2. First of all we activate sheet1 and select all cells ranging from A1 to R8. Then we copy the selection.
After copying, we activate sheet2 and select A1 cell and paste the copied contents.
Sheet1.Select
Worksheets("Sheet1").Range("A1:R8").Select
Selection.Copy
Sheet2.Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
This is how we copy or append the data from one sheet to other in excel macro
Below code will copy data from sheet1 to sheet2. First of all we activate sheet1 and select all cells ranging from A1 to R8. Then we copy the selection.
After copying, we activate sheet2 and select A1 cell and paste the copied contents.
Sheet1.Select
Worksheets("Sheet1").Range("A1:R8").Select
Selection.Copy
Sheet2.Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
This is how we copy or append the data from one sheet to other in excel macro
This macro is great for copying, but it does not append. it simply overwrites any existing data
ReplyDelete