Macro to move rows to a new location

Closed
Blind156 Posts 4 Registration date Friday June 6, 2014 Status Member Last seen June 20, 2014 - Jun 6, 2014 at 08:21 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Jun 7, 2014 at 07:19 AM
Hi, I was hoping for a macro that if in column "C" of an excel spreadsheet it has the number 8 or 9, the whole row gets moved 5 spaces below the the last row in the chart. Please help me figure this out!

1 response

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Jun 7, 2014 at 07:19 AM
suppose data is like this

HDNG1 HDNG2 HDNG3
11 76 1
59 3 2
24 30 8
62 25 6
62 34 9


try this macro


Sub test()
Dim rdata As Range, dest As Range
Set rdata = Range("A1").CurrentRegion
Set dest = Range("A1").End(xlDown).Offset(4, 0)
rdata.AutoFilter field:=3, Criteria1:=8, Operator:=xlOr, Criteria2:=9
rdata.Offset(1, 0).Resize(rdata.Rows.Count - 1).SpecialCells(xlCellTypeVisible).Copy dest
ActiveSheet.AutoFilterMode = False
End Sub
0