cmschmitz24
Board Regular
- Joined
- Jan 27, 2017
- Messages
- 150
Hello, I need help refining a VBA code -
I need to have the entire row for a specific data value in column I moved into a new worksheet.
I am currently using this code, however it also deletes all the data rows underneath the rows that are being moved and that cannot happen.
Thanks,
Christina
I need to have the entire row for a specific data value in column I moved into a new worksheet.
I am currently using this code, however it also deletes all the data rows underneath the rows that are being moved and that cannot happen.
Code:
Dim Check As Range, r As Long, lastrow2 As Long, lastrow As Long
Application.ScreenUpdating = False
lastrow = Worksheets("Export Worksheet").UsedRange.Rows.Count
lastrow2 = Worksheets("Sheet2").UsedRange.Rows.Count
If lastrow2 = 1 Then lastrow2 = 0
For r = lastrow To 2 Step -1
If Range("I" & r).Value = "UWMSN" Then
Rows(r).Cut Destination:=Worksheets("Sheet2").Range("A" & lastrow2 + 1)
lastrow2 = lastrow2 + 1
Else:
End If
Next r
Application.ScreenUpdating = True
Thanks,
Christina