Hi,
I'm looking for a Macro that searches through column J for the word EXPIRED, that it needs to cut the entire row and paste it to another sheet. Can some one please help me with this.
Hi,
I'm looking for a Macro that searches through column J for the word EXPIRED, that it needs to cut the entire row and paste it to another sheet. Can some one please help me with this.
Sure. Should it be done whenever Expired is entered or chosen from a dropdown in the column or on the click of a button?
If I have helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
From a click button and when it paste to other sheet it needs to go into the next available row. Thanks
What is the data range that you have? Does your data start from row2, headers being in row1?
It would start in row 4
What is the data range that you have?
Headers in row 3?
from row 4 to 250
Try this code
Copy the Excel VBA code![]()
Sub move_expired() Dim i As Long, lrow As Long With Worksheets("Sheet1") lrow = .Range("A" & .Rows.Count).End(xlUp).Row For i = lrow To 4 Step -1 If .Range("J" & i).Value = "EXPIRED" Then .Rows(i).Copy Worksheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0) .Rows(i).Delete lrow = lrow - 1 End If Next i End With End Sub
Select the workbook in which you want to store the Excel VBA code
Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
Choose Insert | Module
Where the cursor is flashing, choose Edit | Paste
To run the Excel VBA code:
Choose View | Macros
Select a macro in the list, and click the Run button
Thank you works like a charm
Am glad it worked.
Please mark your thread as solved.
Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks