Hi All:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o></o>
Once AGAIN, I am turning to the experts for an explanation.<o></o>
<o></o>
I have altered a Change Event code that was hiding rows so that I can just run it as a normal macro (when required). I have 2 named ranges and I want the code to look in each cell of the range if if criteria is met then DELETE that row.<o></o>
<o></o>
It seems to work but I have to run the macro a couple of times in order to make sure it has deleted all rows that met the criteria. It seems to leave a few rows in when I run the macro the first time but it finds the rows and deleted them on the 2nd go. I am guessing that I have created code that is not quite understood. Can someone tell me what i am missing?<o></o>
<o></o>
Here are my 2 codes:<o></o>
<o></o>
Any suggestions???
THANKS,
Mark
<o></o>
Once AGAIN, I am turning to the experts for an explanation.<o></o>
<o></o>
I have altered a Change Event code that was hiding rows so that I can just run it as a normal macro (when required). I have 2 named ranges and I want the code to look in each cell of the range if if criteria is met then DELETE that row.<o></o>
<o></o>
It seems to work but I have to run the macro a couple of times in order to make sure it has deleted all rows that met the criteria. It seems to leave a few rows in when I run the macro the first time but it finds the rows and deleted them on the 2nd go. I am guessing that I have created code that is not quite understood. Can someone tell me what i am missing?<o></o>
<o></o>
Here are my 2 codes:<o></o>
Code:
[COLOR=black][FONT=Verdana]Sub PrepareForMAG()[/FONT][/COLOR]
[FONT=Verdana][COLOR=black]'Prepare List For <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><st1:stockticker w:st="on">MAG</st1:stockticker><o:p></o:p>[/COLOR][/FONT]
[COLOR=black][FONT=Verdana][B]'Range <st1:stockticker w:st="on">MAGS</st1:stockticker> starts as $D$3:$D$27 <o:p></o:p>[/B][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]For Each c In Range("<st1:stockticker w:st="on">MAGS</st1:stockticker>")[/FONT][/COLOR]
[FONT=Verdana][COLOR=black]If c.Value = "Entered by NTRMB" Then[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]c.EntireRow.Delete[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]Else[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]End If[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]Next c<o:p></o:p>[/COLOR][/FONT]
[COLOR=black][FONT=Verdana]End Sub<o:p></o:p>[/FONT][/COLOR]
Code:
Sub PrepareForMTRMB()
'Prepare list for NTRMB<o:p></o:p>
'Range NTRMBS starts as !$D$34:$D$58 <o:p></o:p>
For Each c In Range("NTRMBS")
If c.Value = "To be entered by <st1:stockticker w:st="on">MAG</st1:stockticker>" Then
c.EntireRow.Delete
Else
End If
Next c<o:p></o:p>
End Sub<o:p></o:p>
THANKS,
Mark