#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 318
Default Loop


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

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Loop

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

--
Gary's Student
gsnu200703


"Wanna Learn" wrote:


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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 318
Default Loop

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



"Gary''s Student" wrote:

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

--
Gary's Student
gsnu200703


"Wanna Learn" wrote:


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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 318
Default Loop

Gary's Student.... tried the macro it is perfect. thanks

"Gary''s Student" wrote:

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

--
Gary's Student
gsnu200703


"Wanna Learn" wrote:


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

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Loop

You are very welcome! W.r.t. your other problem, I don't know the answer.
--
Gary's Student
gsnu200703


"Wanna Learn" wrote:

Gary's Student.... tried the macro it is perfect. thanks

"Gary''s Student" wrote:

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

--
Gary's Student
gsnu200703


"Wanna Learn" wrote:


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



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 318
Default Loop

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

"Gary''s Student" wrote:

You are very welcome! W.r.t. your other problem, I don't know the answer.
--
Gary's Student
gsnu200703


"Wanna Learn" wrote:

Gary's Student.... tried the macro it is perfect. thanks

"Gary''s Student" wrote:

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

--
Gary's Student
gsnu200703


"Wanna Learn" wrote:


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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using a for loop Jeff Excel Discussion (Misc queries) 1 November 8th 06 10:27 PM
how to put a loop in a macro? Khoshravan New Users to Excel 4 May 14th 06 02:22 PM
Loop time seems dependent on unrelated workbook - Why? Richard Excel Worksheet Functions 2 March 31st 06 12:59 AM
Loop gone crazy Dave Peterson Excel Discussion (Misc queries) 4 December 16th 05 04:38 PM
Do Loop Noemi Excel Discussion (Misc queries) 0 December 8th 05 11:43 PM


All times are GMT +1. The time now is 09:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"