Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 155
Default End of Statement error

I have a macro that writes formulas into several cells. The first 2 work
great but the 3rd and the 4th ones give me an End of Statement error. On the
3rd one it all turns red and gives the error at the "2" at the first
....7,FALSE)= "2"), and likewise at the "1" in the 4th formula.

Here are the 4 formulas. Incidentally these formulas work fine on the
spreadsheet.

ActiveCell.Formula = _

"IF(C24=0,"",IF(ISNA(VLOOKUP(VLOOKUP(($N$8&$C2 4),([Atlanta.xls]item!$B$3:$G$10000),4,FALSE),([Atlanta.xls]Vendor!$A$2:$L$10000),12,FALSE)),"",VLOOKUP(VLOOKU P(($N$8&$C24),([Atlanta.xls]item!$B$3:$G$7002),4,FALSE),([Atlanta.xls]Vendor!$A$2:$L$10000),12,FALSE)))"
ActiveCell.Offset(0, 2).Select

ActiveCell.Formula = _

"IF(ISNA(VLOOKUP(MID(C19,FIND(LEFT(SUBSTITUTE(C19, 0,"")),C19),255),([Atlanta.xls]Atl!$B$1:$L$10000),9,FALSE)),0,IF(C19=0,0,VLOOKUP( MID(C19,FIND(LEFT(SUBSTITUTE(C19,0,"")),C19),255), ([Atlanta.xls]Atl!$B$1:$L$10000),9,FALSE)))"
ActiveCell.Offset(0, 1).Select

ActiveCell.Formula = _
"=IF(ISNA(VLOOKUP($C21,([Atlanta.xls]Atl!$B$1:$L$10000),7,FALSE)=
"2"),F21/(1-M21),IF(F21=0,0,IF((VLOOKUP($C21,([Atlanta.xls]Atl!$B$1:$L$10000),7,FALSE)="2"),VLOOKUP(MID(C21,F IND(LEFT(SUBSTITUTE(C21,0,"")),C21),255),([Atlanta.xls]Atl!$B$1:$L$10000),11,FALSE),F21/(1-M21))))"
ActiveCell.Offset(0, 1).Select

ActiveCell.Formula = _

"IF(ISNA(VLOOKUP($C24,([Atlanta.xls]Atl!$B$1:$L$10000),7,FALSE)),"1",VLOOKUP($C24,([Atlanta.xls]Atl!$B$1:$L$10000),7,FALSE))"

Any Ideas?

Thanks,

Squeaky

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 155
Default End of Statement error

I realized I left out a few of the = signs. When I put them in the code, the
only one that actually works is the first formula. The rest give me an
application defined or object defind error.

"Squeaky" wrote:

I have a macro that writes formulas into several cells. The first 2 work
great but the 3rd and the 4th ones give me an End of Statement error. On the
3rd one it all turns red and gives the error at the "2" at the first
...7,FALSE)= "2"), and likewise at the "1" in the 4th formula.

Here are the 4 formulas. Incidentally these formulas work fine on the
spreadsheet.

ActiveCell.Formula = _

"IF(C24=0,"",IF(ISNA(VLOOKUP(VLOOKUP(($N$8&$C2 4),([Atlanta.xls]item!$B$3:$G$10000),4,FALSE),([Atlanta.xls]Vendor!$A$2:$L$10000),12,FALSE)),"",VLOOKUP(VLOOKU P(($N$8&$C24),([Atlanta.xls]item!$B$3:$G$7002),4,FALSE),([Atlanta.xls]Vendor!$A$2:$L$10000),12,FALSE)))"
ActiveCell.Offset(0, 2).Select

ActiveCell.Formula = _

"IF(ISNA(VLOOKUP(MID(C19,FIND(LEFT(SUBSTITUTE(C19, 0,"")),C19),255),([Atlanta.xls]Atl!$B$1:$L$10000),9,FALSE)),0,IF(C19=0,0,VLOOKUP( MID(C19,FIND(LEFT(SUBSTITUTE(C19,0,"")),C19),255), ([Atlanta.xls]Atl!$B$1:$L$10000),9,FALSE)))"
ActiveCell.Offset(0, 1).Select

ActiveCell.Formula = _
"=IF(ISNA(VLOOKUP($C21,([Atlanta.xls]Atl!$B$1:$L$10000),7,FALSE)=
"2"),F21/(1-M21),IF(F21=0,0,IF((VLOOKUP($C21,([Atlanta.xls]Atl!$B$1:$L$10000),7,FALSE)="2"),VLOOKUP(MID(C21,F IND(LEFT(SUBSTITUTE(C21,0,"")),C21),255),([Atlanta.xls]Atl!$B$1:$L$10000),11,FALSE),F21/(1-M21))))"
ActiveCell.Offset(0, 1).Select

ActiveCell.Formula = _

"IF(ISNA(VLOOKUP($C24,([Atlanta.xls]Atl!$B$1:$L$10000),7,FALSE)),"1",VLOOKUP($C24,([Atlanta.xls]Atl!$B$1:$L$10000),7,FALSE))"

Any Ideas?

Thanks,

Squeaky

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 155
Default End of Statement error

Now that I made a real mess of this posting, I actually left out the first
code that works. Here it is.

Range("B24").Select
ActiveCell.Formula = _

"=IF(ISNA(VLOOKUP(MID(C24,FIND(LEFT(SUBSTITUTE(C24 ,0,"""")),C24),255),([Atlanta.xls]item!$B$1:$G$10000),5,FALSE)),"""",IF(C24=0,"""",( VLOOKUP(MID(C25,FIND(LEFT(SUBSTITUTE(C24,0,"""")), C24),255),([Atlanta.xls]item!$B$1:$G$10000),5,FALSE))))"

The rest I made by copy/paste of the above and then copy/paste of the
formulas in the quotes.

"Squeaky" wrote:

I have a macro that writes formulas into several cells. The first 2 work
great but the 3rd and the 4th ones give me an End of Statement error. On the
3rd one it all turns red and gives the error at the "2" at the first
...7,FALSE)= "2"), and likewise at the "1" in the 4th formula.

Here are the 4 formulas. Incidentally these formulas work fine on the
spreadsheet.

ActiveCell.Formula = _

"=IF(C24=0,"",IF(ISNA(VLOOKUP(VLOOKUP(($N$8&$C24), ([Atlanta.xls]item!$B$3:$G$10000),4,FALSE),([Atlanta.xls]Vendor!$A$2:$L$10000),12,FALSE)),"",VLOOKUP(VLOOKU P(($N$8&$C24),([Atlanta.xls]item!$B$3:$G$7002),4,FALSE),([Atlanta.xls]Vendor!$A$2:$L$10000),12,FALSE)))"
ActiveCell.Offset(0, 2).Select

ActiveCell.Formula = _

"=IF(ISNA(VLOOKUP(MID(C19,FIND(LEFT(SUBSTITUTE(C19 ,0,"")),C19),255),([Atlanta.xls]Atl!$B$1:$L$10000),9,FALSE)),0,IF(C19=0,0,VLOOKUP( MID(C19,FIND(LEFT(SUBSTITUTE(C19,0,"")),C19),255), ([Atlanta.xls]Atl!$B$1:$L$10000),9,FALSE)))"
ActiveCell.Offset(0, 1).Select

ActiveCell.Formula = _
"=IF(ISNA(VLOOKUP($C21,([Atlanta.xls]Atl!$B$1:$L$10000),7,FALSE)=
"2"),F21/(1-M21),IF(F21=0,0,IF((VLOOKUP($C21,([Atlanta.xls]Atl!$B$1:$L$10000),7,FALSE)="2"),VLOOKUP(MID(C21,F IND(LEFT(SUBSTITUTE(C21,0,"")),C21),255),([Atlanta.xls]Atl!$B$1:$L$10000),11,FALSE),F21/(1-M21))))"
ActiveCell.Offset(0, 1).Select

ActiveCell.Formula = _

"=IF(ISNA(VLOOKUP($C24,([Atlanta.xls]Atl!$B$1:$L$10000),7,FALSE)),"1",VLOOKUP($C24,([Atlanta.xls]Atl!$B$1:$L$10000),7,FALSE))"

Any Ideas?

Thanks,

Squeaky

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 155
Default End of Statement error

Nevermind. I figured it out myself.

"Squeaky" wrote:

I have a macro that writes formulas into several cells. The first 2 work
great but the 3rd and the 4th ones give me an End of Statement error. On the
3rd one it all turns red and gives the error at the "2" at the first
...7,FALSE)= "2"), and likewise at the "1" in the 4th formula.

Here are the 4 formulas. Incidentally these formulas work fine on the
spreadsheet.

ActiveCell.Formula = _

"IF(C24=0,"",IF(ISNA(VLOOKUP(VLOOKUP(($N$8&$C2 4),([Atlanta.xls]item!$B$3:$G$10000),4,FALSE),([Atlanta.xls]Vendor!$A$2:$L$10000),12,FALSE)),"",VLOOKUP(VLOOKU P(($N$8&$C24),([Atlanta.xls]item!$B$3:$G$7002),4,FALSE),([Atlanta.xls]Vendor!$A$2:$L$10000),12,FALSE)))"
ActiveCell.Offset(0, 2).Select

ActiveCell.Formula = _

"IF(ISNA(VLOOKUP(MID(C19,FIND(LEFT(SUBSTITUTE(C19, 0,"")),C19),255),([Atlanta.xls]Atl!$B$1:$L$10000),9,FALSE)),0,IF(C19=0,0,VLOOKUP( MID(C19,FIND(LEFT(SUBSTITUTE(C19,0,"")),C19),255), ([Atlanta.xls]Atl!$B$1:$L$10000),9,FALSE)))"
ActiveCell.Offset(0, 1).Select

ActiveCell.Formula = _
"=IF(ISNA(VLOOKUP($C21,([Atlanta.xls]Atl!$B$1:$L$10000),7,FALSE)=
"2"),F21/(1-M21),IF(F21=0,0,IF((VLOOKUP($C21,([Atlanta.xls]Atl!$B$1:$L$10000),7,FALSE)="2"),VLOOKUP(MID(C21,F IND(LEFT(SUBSTITUTE(C21,0,"")),C21),255),([Atlanta.xls]Atl!$B$1:$L$10000),11,FALSE),F21/(1-M21))))"
ActiveCell.Offset(0, 1).Select

ActiveCell.Formula = _

"IF(ISNA(VLOOKUP($C24,([Atlanta.xls]Atl!$B$1:$L$10000),7,FALSE)),"1",VLOOKUP($C24,([Atlanta.xls]Atl!$B$1:$L$10000),7,FALSE))"

Any Ideas?

Thanks,

Squeaky

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
If Statement Error Kiley Excel Discussion (Misc queries) 3 May 18th 09 10:25 PM
IF statement error D Excel Discussion (Misc queries) 4 October 4th 06 04:28 PM
Runtime Error - Subscript out of range despite On Error statement DoctorG Excel Programming 3 July 28th 06 03:56 PM
Path/File access error (Error 75) using Name Statement blayne Excel Programming 7 November 22nd 05 09:20 PM
Path/File access error (Error 75) after using Name Statement blayne Excel Programming 0 November 10th 05 12:33 AM


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