Loop

W

Wanna Learn

Hello
On a daily basis I import 4 columns of data , the total number of rows is
different everyday. On column C I need to delete the rows that do not
contain the words , FAX, GFX, PH, TOT . Is there a macro for this ? As
always Thanks
 
G

Gary''s Student

Try:

Sub wanna()
Dim r As Range, i As Long
i = Range("c" & Rows.Count).End(xlUp).Row
Set r = Cells(i + 1, "c")
For j = 1 To i
v = Cells(j, "c").Value
If v = "FAX" Or v = "GFX" Or v = "PH" Or v = "TOT" Then
Else
Set r = Union(r, Cells(j, "c"))
End If
Next
r.EntireRow.Delete
End Sub
 
W

Wanna Learn

Thanks Gary's student
I have a bigger problem...I was going to create this macro and here is my
story.. or should I say mess.
I have 2 macro workbooks one named Personal.exl and the other
MePersonal.exl. This morning I decided to save these work books to a flash
drive. Then in the C drive I changed the names to Personal1.exl and
MePersonal1exl now when I try to record a macro the only options I have to
store the macro is PersonalMacro workbook , New Workbook and This Workbook.
All Open Workbooks Options is gone. All Open Workbooks Options is gone.
Help! Help! I do not have the option to save the new macro to Personal1,exl
or MePersoanl.exl. Please save me !!!! Thanks
 
W

Wanna Learn

Gary"s Student Again Thanks
I did not resolve the other problem....(Kind of) I am able to create a macro
to a new personal workbook, but I cannot add macros to the other
Personal1.exl and MePersonal1.exl workbook Still looking for an answer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top