Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Cells Within Range Failure?

I don't know why, but the compiler is protesting the second to last line and
I don't know why. What have I missed?

Thanks

For i = maxrows To 2 Step -1
FormulaStr =
"=IF(ISNA(VLOOKUP(cells(i,1),[NegsExceptions.xls]Sheet1!$A$1:$C$18,1,FALSE)),""x"",VLOOKUP(cells(i, 1),[NegsExceptions.xls]Sheet1!$A$1:$C$18,1,FALSE))"
Range(Cells(i, 5)).Formula = FormulaStr
Next i

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Cells Within Range Failure?

Bob,

There was also an error in your Vlookup because you had
cells(i,1) inside the quotes it was treated as text and you wanted a
variable. try this instead

For i = maxrows To 2 Step -1
FormulaStr = "=IF(ISNA(VLOOKUP(" & Cells(i, 1).Address &
",[NegsExceptions.xls]Sheet1!$A$1:$C$18,1,FALSE)),""x"",VLOOKUP(" & Cells(i,
1).Address & ",[NegsExceptions.xls]Sheet1!$A$1:$C$18,1,FALSE))"
Cells(i, 5).Formula = FormulaStr
Next i


Mike


"Bob Zimski" wrote:

I don't know why, but the compiler is protesting the second to last line and
I don't know why. What have I missed?

Thanks

For i = maxrows To 2 Step -1
FormulaStr =
"=IF(ISNA(VLOOKUP(cells(i,1),[NegsExceptions.xls]Sheet1!$A$1:$C$18,1,FALSE)),""x"",VLOOKUP(cells(i, 1),[NegsExceptions.xls]Sheet1!$A$1:$C$18,1,FALSE))"
Range(Cells(i, 5)).Formula = FormulaStr
Next i

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Cells Within Range Failure?

What you have will not produce a valid formula. In your string you have
cells(i,1)
which is not going to be evalueated to a value. It will be exactly what you
see.

"=IF(ISNA(VLOOKUP(" & cells(i,1) &
",[NegsExceptions.xls]Sheet1!$A$1:$C$18,1,FALSE)),""x"",VLOOKUP(" &
cells(i,1) & ",[NegsExceptions.xls]Sheet1!$A$1:$C$18,1,FALSE))"

Assuming all else to be correct
--
HTH...

Jim Thomlinson


"Bob Zimski" wrote:

I don't know why, but the compiler is protesting the second to last line and
I don't know why. What have I missed?

Thanks

For i = maxrows To 2 Step -1
FormulaStr =
"=IF(ISNA(VLOOKUP(cells(i,1),[NegsExceptions.xls]Sheet1!$A$1:$C$18,1,FALSE)),""x"",VLOOKUP(cells(i, 1),[NegsExceptions.xls]Sheet1!$A$1:$C$18,1,FALSE))"
Range(Cells(i, 5)).Formula = FormulaStr
Next i

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
vlookup failure & ctrl-f failure? joemeshuggah Excel Discussion (Misc queries) 4 December 22nd 08 07:22 PM
autofill range class failure Susan Excel Programming 5 September 22nd 06 09:16 PM
how to compute a range of cells based on another range of cells? HAROLD Excel Worksheet Functions 1 December 30th 05 09:32 PM
Range object global failure Otto Moehrbach Excel Programming 1 March 11th 05 08:55 PM
Select method of Range class failure Stuart[_5_] Excel Programming 3 February 24th 04 06:35 PM


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