Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
associates
 
Posts: n/a
Default formula typed contains an error


Hi,

I was wondering if anyone might be able to help me out. I've got some
error message saying " the formula you typed contains an error" after
putting in the following code.

Here is my code,

for i = 0 to ubound(x)
c = chr(65 + i) + trim(str(Count) ' Count is the row number
with worksheets("Sheet1")
with .range(c$)
.FormatConditions.Delete
.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual,
Formula1:="=my" & c$
.FormatConditions(1).Interior.ColorIndex = 36
.FormatConditions.Add Type:=xlCellValue,
Operator:=xlNotEqual, Formula1:="my" & c$
.FormatConditions(1).Interior.ColorIndex = 42
end with
end with

rowline1 = "my" & c$
mysht = "=Sheet2!R" & cstr(Count) & "C" & cstr(i)
with ActiveWorkbook
.Names.Add Name:=rowline1, RefersToR1C1:=mysht
end with
...

next i

Any ideas?

Thank you in advance


--
associates
------------------------------------------------------------------------
associates's Profile: http://www.excelforum.com/member.php...o&userid=35073
View this thread: http://www.excelforum.com/showthread...hreadid=550789

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Chip Pearson
 
Posts: n/a
Default formula typed contains an error

The code will fail when i = 0 and the formula mysht is
=Sheet2!R1C0

Names.Add Name:=rowline1, RefersToR1C1:=mysht

You need to configure you code so that it will work with a loop
like

For i = 1 To UBound(x)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"associates"
wrote
in message
...

Hi,

I was wondering if anyone might be able to help me out. I've
got some
error message saying " the formula you typed contains an error"
after
putting in the following code.

Here is my code,

for i = 0 to ubound(x)
c = chr(65 + i) + trim(str(Count) ' Count is the row number
with worksheets("Sheet1")
with .range(c$)
FormatConditions.Delete
FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual,
Formula1:="=my" & c$
FormatConditions(1).Interior.ColorIndex = 36
FormatConditions.Add Type:=xlCellValue,
Operator:=xlNotEqual, Formula1:="my" & c$
FormatConditions(1).Interior.ColorIndex = 42
end with
end with

rowline1 = "my" & c$
mysht = "=Sheet2!R" & cstr(Count) & "C" & cstr(i)
with ActiveWorkbook
Names.Add Name:=rowline1, RefersToR1C1:=mysht
end with
..

next i

Any ideas?

Thank you in advance


--
associates
------------------------------------------------------------------------
associates's Profile:
http://www.excelforum.com/member.php...o&userid=35073
View this thread:
http://www.excelforum.com/showthread...hreadid=550789



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
remove error value when formula exists for empty cells Cyrus Excel Worksheet Functions 2 February 17th 06 04:19 PM
I get error with "ROWS" in the formula - nested formula question Marie J-son Excel Worksheet Functions 0 January 4th 06 01:55 PM
formula too long error SB Excel Discussion (Misc queries) 2 December 19th 05 09:56 PM
Formula syntax error - chinese and gibberish Joshua Fandango Excel Discussion (Misc queries) 3 March 29th 05 01:27 PM
Formula error... Jambruins Excel Discussion (Misc queries) 2 February 24th 05 09:57 PM


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