In the last few days there have been many questions about copying and pasting data in Excel with VBA. Many people wish to copy and paste non-contiguous data or copy and paste data while transposing the data. Of course, we can also copy and paste data from one workbook to another automatically. Watch the training video:
Watch this video on YouTube.
The complete VBA code is given below:
Copy and Paste Data with Transpose:
Sub copytranspose()
Range(“A2,A4,A7”).Copy
Sheet3.Range(“A2”).PasteSpecial , Transpose:=True
Range(“A2,A4,A7”).Copy
Sheet3.Range(“A2”).PasteSpecial , Transpose:=True
End Sub
Copy and Paste non-contiguous date to another worksheet:
Sub mycopypaste()
Range(“A2,A4,A7”).Copy Sheet2.Range(“A2”)
End Sub
Copy and Paste data:
Sub copypaste()
Sheet1.Range(“A2:A4”).Copy Range(“E2”)
End Sub
Step by step VBA code to copy and paste data:
Sub copyrange()
Range(“A2:A4”).Select
Selection.Copy
Range(“D2”).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range(“A2:A4”).Select
Selection.Copy
Range(“D2”).Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
Sir you are great