Hi,
I am working on a macro that searches for text, then cuts the row that contains the text and pastes it towards the top of the sheet. I get an error when it attempts to paste in the row that already contains the data (ex: if "Atlanta is already in row 15). Below is what I currently have coded. Any ideas?
Range("A1:J1").Select
Set f = Cells.Find(What:="Atlanta")
Rows(f.Row).Select
Rows(f.Row).Activate
Selection.Cut
Rows("15:15").Select
Selection.Insert Shift:=xlDown
Range("A16").Select
Range("A1:J1").Select
Set f = Cells.Find(What:="Boston")
Rows(f.Row).Select
Rows(f.Row).Activate
Selection.Cut
Rows("16:16").Select
Selection.Insert Shift:=xlDown
Range("A17").Select
I am working on a macro that searches for text, then cuts the row that contains the text and pastes it towards the top of the sheet. I get an error when it attempts to paste in the row that already contains the data (ex: if "Atlanta is already in row 15). Below is what I currently have coded. Any ideas?
Range("A1:J1").Select
Set f = Cells.Find(What:="Atlanta")
Rows(f.Row).Select
Rows(f.Row).Activate
Selection.Cut
Rows("15:15").Select
Selection.Insert Shift:=xlDown
Range("A16").Select
Range("A1:J1").Select
Set f = Cells.Find(What:="Boston")
Rows(f.Row).Select
Rows(f.Row).Activate
Selection.Cut
Rows("16:16").Select
Selection.Insert Shift:=xlDown
Range("A17").Select