What is it doing / not doing?
I suspect I know the answer.
You've created a loop from A1-H1000,
it looks like you want to delete any row that has a 
cell that begins with "FF".

Let's take a look at this example:
let's say you have the data:
        A      B     C
1    (AA11) (BB12) (CC13)
2    (AA21) (FF22) (CC23)
3    (FF31) (BB32) (CC33)
4    (AA41) (BB42) (CC43)

And you want to delete rows 2 and 3, since they each have "FF*" values.

You use 
For Each c In [A1:C4]
  If c.Value Like "FF*" Then
     c.Select
     c.Delete
     ActiveCell.EntireRow.Delete
  End If
Next
 
Now, the first loop,
it checks Cell A1, then B1 and B3 (it may move by column, depending on default 
settings)
Then, it moves to row 2.
Your loop hits B2, finds "FF", 
selects B2,
clears the contents of B2
Selects the entire row 2 and deletes it.
 
Notice that at this point, row 3 becomes the "new" row 2 
and the data looks like:

        A      B     C
1    (AA11) (BB12) (CC13)
2    (FF31) (BB32) (CC33)
3    (AA41) (BB42) (CC43)

Now, the next iteration of the loop is C2.
NOT A2!!!
then moves to A3, B2, C3
thereby missing evaluating the FF31 value.
 
to fix this, first of all, I suspect that you
didn't really mean to look at ALL cells, but perhaps only
column "A" ??
What I would do is reverse the loop.
try:
 
'-----------------------------------------------
Rowcnt = application.worksheetfunction.counta(range("A1:A65000") 'Determines 
total rows
 
for R = rowcnt to 1 step -1
    if (cells(R,1) like "FF*" then
        Cells(r,1).entirerow.delete
    end if
next R
'-----------------------------------------------


hope this helps.
 
Paul

----- Original Message ----
> From: Mehdi_21 <meh.i...@gmail.com>
> To: MS EXCEL AND VBA MACROS <excel-macros@googlegroups.com>
> Sent: Sunday, February 1, 2009 2:55:31 PM
> Subject: $$Excel-Macros$$ help me please ;)
> 
> 
> hey guys, how r u all?
> 
> i started a macro that imports a text file to a worksheet, it all
> worked but when it comes to the part where the program must suppress
> specific cells it doesn't work , here's the code, plz do help ;)
> 
> Private Sub parcourir_Click()
> 
> 
> 
>     Dim vFile As Variant
> 
>     'Showing Excel Open Dialog Form
>     vFile = Application.GetOpenFilename("Text Files (*.txt)," & _
>     "*.txt", 1, "Select Text File", "Open", False)
> 
>     'If Cancel then exit
>     If TypeName(vFile) = "Boolean" Then
>         Exit Sub
>     End If
> 
>     'Open selected file
>     Workbooks.OpenText vFile, Origin:=xlMSDOS, StartRow:=1,
> DataType:=xlDelimited, TextQualifier:= _
>         xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True,
> Semicolon:=False, _
>         Comma:=True, Space:=False, Other:=False, FieldInfo:=Array(Array
> (1, 1), _
>         Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6,
> 1), Array(7, 1), Array(8, 1), _
>         Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array
> (13, 1), Array(14, 1), Array(15 _
>         , 1)), TrailingMinusNumbers:=True
> 
> 
>   ' here's where the program doesn't seem to work
> 
> For Each c In [A1:H1000]
>     If c.Value Like "FF*" Then
>     c.Select
>     c.Delete
>     ActiveCell.EntireRow.Delete
> 
> 
>     End If
> Next
> 
> Unload Me
> End Sub
> 
> thanks ;)
> 
> 

--~--~---------~--~----~------------~-------~--~----~
Visit the blog to download Excel tutorials at 
http://www.excel-macros.blogspot.com

To post to this group, send email to excel-macros@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/excel-macros?hl=en

Visit & Join Our Orkut Community at 
http://www.orkut.com/Community.aspx?cmm=22913620

To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com

To see the Daily Excel Tips, Go to:
http://exceldailytip.blogspot.com
 
If you find any spam message in the group, please send an email to Ayush @ 
jainayus...@gmail.com
-~----------~----~----~----~------~----~------~--~---

Reply via email to