Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Error - End If Without Block

Hi There...for the likes of me, i just can't get this to work!
Can anyone help?
Sandi

the following is a snippet of my module that won't work - i've already
declared "Dim X As Long" in a previous procedure - and incidentially, i
started the range with column C, because the last two cells in column A are
blank:

' CODE TO DELETE ROWS WHICH CONTAIN BLANK VALUES IN COLUMN A, AND "FALSE"
IN COLUMN I
For X = Range("C65536").End(xlUp).Row To 1 Step -1
If Range("A" & X) = "" Or _
Range("I" & X) = "FALSE" Then _
Range("A" & X).EntireRow.Delete
End If
Next


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Error - End If Without Block

since you made your If statement a single line IF statement, you don't need
an End IF

For X = Range("C65536").End(xlUp).Row To 1 Step -1
If Range("A" & X) = "" Or _
Range("I" & X) = "FALSE" Then _
Range("A" & X).EntireRow.Delete
Next

--
Regards,
Tom Ogilvy

"Gauthier" wrote in message
...
Hi There...for the likes of me, i just can't get this to work!
Can anyone help?
Sandi

the following is a snippet of my module that won't work - i've already
declared "Dim X As Long" in a previous procedure - and incidentially, i
started the range with column C, because the last two cells in column A

are
blank:

' CODE TO DELETE ROWS WHICH CONTAIN BLANK VALUES IN COLUMN A, AND

"FALSE"
IN COLUMN I
For X = Range("C65536").End(xlUp).Row To 1 Step -1
If Range("A" & X) = "" Or _
Range("I" & X) = "FALSE" Then _
Range("A" & X).EntireRow.Delete
End If
Next




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Error - End If Without Block

Hi
try:
' CODE TO DELETE ROWS WHICH CONTAIN BLANK VALUES IN COLUMN A, AND
"FALSE"
IN COLUMN I
For X = Range("C65536").End(xlUp).Row To 1 Step -1
If Range("A" & X) = "" Or _
Range("I" & X) = "FALSE" Then
Range("A" & X).EntireRow.Delete
End If
Next

--
Regards
Frank Kabel
Frankfurt, Germany

"Gauthier" schrieb im Newsbeitrag
...
Hi There...for the likes of me, i just can't get this to work!
Can anyone help?
Sandi

the following is a snippet of my module that won't work - i've

already
declared "Dim X As Long" in a previous procedure - and incidentially,

i
started the range with column C, because the last two cells in column

A are
blank:

' CODE TO DELETE ROWS WHICH CONTAIN BLANK VALUES IN COLUMN A, AND

"FALSE"
IN COLUMN I
For X = Range("C65536").End(xlUp).Row To 1 Step -1
If Range("A" & X) = "" Or _
Range("I" & X) = "FALSE" Then _
Range("A" & X).EntireRow.Delete
End If
Next



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Error - End If Without Block

Your problem is here is with the underscore before the Delete. Get rid of it
and you are golden... or get rid of the end if. Either way will do

If Range("A" & X) = "" Or _
Range("I" & X) = "FALSE" Then
Range("A" & X).EntireRow.Delete
End If

or

If Range("A" & X) = "" Or _
Range("I" & X) = "FALSE" Then _
Range("A" & X).EntireRow.Delete

Hope this helps...

"Gauthier" wrote:

Hi There...for the likes of me, i just can't get this to work!
Can anyone help?
Sandi

the following is a snippet of my module that won't work - i've already
declared "Dim X As Long" in a previous procedure - and incidentially, i
started the range with column C, because the last two cells in column A are
blank:

' CODE TO DELETE ROWS WHICH CONTAIN BLANK VALUES IN COLUMN A, AND "FALSE"
IN COLUMN I
For X = Range("C65536").End(xlUp).Row To 1 Step -1
If Range("A" & X) = "" Or _
Range("I" & X) = "FALSE" Then _
Range("A" & X).EntireRow.Delete
End If
Next



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Solved - now the "FALSE" rows are not deleting

Thanks Tom...
i ran the code, and for some reason, rows in col "I" which have "FALSE" in
them are not deleting...
the entire column "I" contains primarily numbers and is formatted as a
NUMBER - is that what's causing the problem??
Sandi


"Tom Ogilvy" wrote in message
...
since you made your If statement a single line IF statement, you don't

need
an End IF

For X = Range("C65536").End(xlUp).Row To 1 Step -1
If Range("A" & X) = "" Or _
Range("I" & X) = "FALSE" Then _
Range("A" & X).EntireRow.Delete
Next

--
Regards,
Tom Ogilvy

"Gauthier" wrote in message
...
Hi There...for the likes of me, i just can't get this to work!
Can anyone help?
Sandi

the following is a snippet of my module that won't work - i've already
declared "Dim X As Long" in a previous procedure - and incidentially, i
started the range with column C, because the last two cells in column A

are
blank:

' CODE TO DELETE ROWS WHICH CONTAIN BLANK VALUES IN COLUMN A, AND

"FALSE"
IN COLUMN I
For X = Range("C65536").End(xlUp).Row To 1 Step -1
If Range("A" & X) = "" Or _
Range("I" & X) = "FALSE" Then _
Range("A" & X).EntireRow.Delete
End If
Next








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Solved - now the "FALSE" rows are not deleting

You are checking for the string "FALSE". If they have the boolean value
False, you might want to check for that instead:

For X = Range("C65536").End(xlUp).Row To 1 Step -1
If Range("A" & X) = "" Or _
Range("I" & X) = FALSE Then _
Range("A" & X).EntireRow.Delete
Next

--
Regards,
Tom Ogilvy

"Gauthier" wrote in message
...
Thanks Tom...
i ran the code, and for some reason, rows in col "I" which have "FALSE" in
them are not deleting...
the entire column "I" contains primarily numbers and is formatted as a
NUMBER - is that what's causing the problem??
Sandi


"Tom Ogilvy" wrote in message
...
since you made your If statement a single line IF statement, you don't

need
an End IF

For X = Range("C65536").End(xlUp).Row To 1 Step -1
If Range("A" & X) = "" Or _
Range("I" & X) = "FALSE" Then _
Range("A" & X).EntireRow.Delete
Next

--
Regards,
Tom Ogilvy

"Gauthier" wrote in message
...
Hi There...for the likes of me, i just can't get this to work!
Can anyone help?
Sandi

the following is a snippet of my module that won't work - i've already
declared "Dim X As Long" in a previous procedure - and incidentially,

i
started the range with column C, because the last two cells in column

A
are
blank:

' CODE TO DELETE ROWS WHICH CONTAIN BLANK VALUES IN COLUMN A, AND

"FALSE"
IN COLUMN I
For X = Range("C65536").End(xlUp).Row To 1 Step -1
If Range("A" & X) = "" Or _
Range("I" & X) = "FALSE" Then _
Range("A" & X).EntireRow.Delete
End If
Next








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Error - End If Without Block

...Blank values in Column A, AND "False" in column i...

In addition, your note says to use "And", but your code is using "Or."
Could that be another source of your problem?

HTH
Dana DeLouis


"Gauthier" wrote in message
...
Hi There...for the likes of me, i just can't get this to work!
Can anyone help?
Sandi

the following is a snippet of my module that won't work - i've already
declared "Dim X As Long" in a previous procedure - and incidentially, i
started the range with column C, because the last two cells in column A
are
blank:

' CODE TO DELETE ROWS WHICH CONTAIN BLANK VALUES IN COLUMN A, AND
"FALSE"
IN COLUMN I
For X = Range("C65536").End(xlUp).Row To 1 Step -1
If Range("A" & X) = "" Or _
Range("I" & X) = "FALSE" Then _
Range("A" & X).EntireRow.Delete
End If
Next




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
Compile Error: Block If without End if [email protected] Excel Discussion (Misc queries) 4 March 3rd 06 06:30 PM
VBA error - End If without Block If Jane Excel Worksheet Functions 2 December 6th 05 06:00 PM
Error 91, Object var or With block not set Walter Excel Programming 2 August 24th 04 12:37 AM
Runtime error 91: Objust variable or with block.... paritoshmehta[_23_] Excel Programming 1 July 29th 04 01:57 PM
compile error: block if without end if whelanj Excel Programming 4 June 9th 04 07:32 PM


All times are GMT +1. The time now is 09:48 PM.

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

About Us

"It's about Microsoft Excel"