I need to implement a VBA Macro that copies data from one excel worksheet and puts certain column into another one.
Sub sbCopyRangeToAnotherSheet()
'Method 1
Sheets("Sheet1").Range("A1:B10").Copy Destination:=Sheets("Sheet2").Range("E1")
'Method 2
'Copy the data
Sheets("Sheet1").Range("A1:B10").Copy
'Activate the destination worksheet
Sheets("Sheet2").Activate
'Select the target range
Range("E1").Select
'Paste in the target destination
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
This wont work for new sheets named for example Sheet 3 neither will it run effectively for filtered data. I need a code that can copy the filtered data and paste certain column into another worksheet.
No comments:
Post a Comment