Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
"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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy a block of cells | Excel Discussion (Misc queries) | |||
How to copy block of cells and keep grouping? | Excel Discussion (Misc queries) | |||
Block an area of sheet from Printing? | Excel Discussion (Misc queries) | |||
Can I right AND left justify to block text in excel? | Excel Discussion (Misc queries) | |||
Changing the format of a block of data | Excel Discussion (Misc queries) |