Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jane
 
Posts: n/a
Default VBA error - End If without Block If

here is my VBA code:

Lastrow = Range("A65536").End(xlUp).Row
Range("L19", "L820").FormulaR1C1 = "0"

For I = 19 To Lastrow
If Range("L15").Value < 0 Then Range("L" & I).ClearContents
Range("L" & I).FormulaR1C1 = _

"=AND(R2C12=1,RC9=1,R3C12<""n"")*RC[12]+AND(R2C13=2,RC9=2,R3C13<""n"")*RC[12]+AND(R2C14=3,RC9=3,R3C14<""n"")*RC[12]+AND(R2C15=4,RC9=4,R3C15<""n"")*RC[12]+AND(R2C16=5,RC9=5,R3C16<""n"")*RC[12]+AND(R2C17=6,RC9=6,R3C17<""n"")*RC[12]+AND(R2C18=7,RC9=7,R3C18<""n"")*RC[12]+AND(R2C19=8,RC9=8,R3C19<""n"")*RC[12]+AND(R2C20=9,RC9=9,R3C20<""n"")*RC[12]+AND(R2C21=10,RC9=10,R3C21<""n"")*RC[12]"
Range("L19").Select
Exit For
End If
Next I

I get the following error: End If without Block If
What do I need to change?
thank you in advance! jane
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bruno Campanini
 
Posts: n/a
Default VBA error - End If without Block If

"Jane" wrote in message
...
here is my VBA code:

Lastrow = Range("A65536").End(xlUp).Row
Range("L19", "L820").FormulaR1C1 = "0"

For I = 19 To Lastrow
If Range("L15").Value < 0 Then Range("L" & I).ClearContents
Range("L" & I).FormulaR1C1 = _

"=AND(R2C12=1,RC9=1,R3C12<""n"")*RC[12]+AND(R2C13=2,RC9=2,R3C13<""n"")*RC[12]+AND(R2C14=3,RC9=3,R3C14<""n"")*RC[12]+AND(R2C15=4,RC9=4,R3C15<""n"")*RC[12]+AND(R2C16=5,RC9=5,R3C16<""n"")*RC[12]+AND(R2C17=6,RC9=6,R3C17<""n"")*RC[12]+AND(R2C18=7,RC9=7,R3C18<""n"")*RC[12]+AND(R2C19=8,RC9=8,R3C19<""n"")*RC[12]+AND(R2C20=9,RC9=9,R3C20<""n"")*RC[12]+AND(R2C21=10,RC9=10,R3C21<""n"")*RC[12]"
Range("L19").Select
Exit For
End If
Next I

I get the following error: End If without Block If
What do I need to change?
thank you in advance! jane


You don't need End If as your previous If is
a one-line clause (If ... Then ...).

Bruno


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
copy a block of cells florin Excel Discussion (Misc queries) 2 October 12th 05 03:16 PM
How to copy block of cells and keep grouping? dstock Excel Discussion (Misc queries) 2 July 6th 05 08:42 PM
Block an area of sheet from Printing? lbbss Excel Discussion (Misc queries) 4 June 8th 05 07:21 PM
Can I right AND left justify to block text in excel? wink53083 Excel Discussion (Misc queries) 2 January 25th 05 08:59 PM
Changing the format of a block of data Greg Excel Discussion (Misc queries) 0 January 23rd 05 02:30 AM


All times are GMT +1. The time now is 06:59 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"