Hello, I need a macro to delete and entire row and associated row for an id number that doesn't start with 5.
Attached is an example of what I have and what I need to create.
Thanks In Advance,
Keenan
Hello, I need a macro to delete and entire row and associated row for an id number that doesn't start with 5.
Attached is an example of what I have and what I need to create.
Thanks In Advance,
Keenan
Thank you for not helping me!
PLS DO NOT PM; OPEN A THREAD INSTEAD!!!
1) Posting Code
[CODE]PasteYourCodeHere[/CODE]
(or paste your code, select it, click # button)
2) Uploading File(s)
Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.
3) Testing the Codes
always back up your files before testing the codes.
4) Marking the Thread as Solved
from Thread Tools (on the top right corner, above the first message)
Thanks :-)
Merged cells, Error cells, White text: You believe in making things difficult.
Option Compare Text Sub Test() Call Test1 Call Test2 End Sub Sub Test1() Dim PL As Worksheet Dim Rw As Long Set PL = Sheets("Price List") With PL For Rw = 175 To 4 Step -9 If Left(.Cells(Rw, 4), 1) <> 5 Then .Cells(Rw, 4).Resize(9).EntireRow.Delete End If Next Rw End With End Sub Sub Test2() Dim OF As Worksheet Dim Rw As Long Set OF = Sheets("Order Form") With OF For Rw = 67 To 7 Step -1 If Not Application.IsError(.Cells(Rw, 4)) Then If Left(.Cells(Rw, 4), 1) <> 5 And .Cells(Rw, 4) <> "" And Left(.Cells(Rw, 4), 1) <> "M" Then .Cells(Rw, 2).MergeArea.EntireRow.Delete End If End If Next Rw End With End Sub
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Thanks!!!