Hi,
I am trying to create a macro to copy specific columns from one sheet to another based on certain condition.
I have dropdown of dates from sheet 1.If I run the macro it will look for the date in the dates column in sheet 1 and will copy and paste specific columns which with that date into another sheet or workbook.
I have tried the following.
Please help me for this.
Thank you!
I am trying to create a macro to copy specific columns from one sheet to another based on certain condition.
I have dropdown of dates from sheet 1.If I run the macro it will look for the date in the dates column in sheet 1 and will copy and paste specific columns which with that date into another sheet or workbook.
I have tried the following.
Code:
Sub MoveData()
For Each cell In Worksheets("HS").Range("B3:B50") ' Where to look for the date
If cell.Value = "9/17/2018" Then ' The date
Range("B4:L50").Select ' What is the range to copy
Selection.Copy ' Copy it
Sheets("Jun").Select ' Select the Sheet it applies to
Range("A1").Select ' Where to paste the data
ActiveSheet.Paste
Sheets("HS").Select ' Go back to the templete sheet
Range("A1").Select
Application.CutCopyMode = False ' Remove the copy mode
End If
Next ' Move forward to the next
End Sub
Please help me for this.
Thank you!
Last edited by a moderator: