Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default error passing a formula to a cell from a string


buyin, buyinmod, datemod, and fieldmod r all strings. the following ar
4 expample of formulas i am trying to pass, but am gettin
"application-defined or object defined" errors.
can anyone see where my mstake is?


Buyin = "=(Sheets(""Tourney Info"").Range(""D" & Row
""").Value)/(Sheets(""Tourney Info"").Range(""E" & Row & """).Value)"
BuyinMod = "=LN((Sheets(""Tourney Info"").Range(""G" & Row
""").Value)/100+1)"
FieldMod = "=(Sheets(""Tourney Info"").Range(""E" & Row
""").Value)/10-(Sheets(""Tourney Info"").Range(""E" & Row
""").Value)^2/20000"
DateMid = "=36/(MONTH(NOW())-(Sheets(""Tourney Info"").Range(""B"
Row & """).Value)+12*(YEAR(NOW())-(Sheets(""Tourney Info"").Range(""C"
Row & """).Value))+36)"

If Sheets("Tourney Info").Range("G" & Row).Formula < Buyin Then
Sheets("Tourney Info").Range("G" & Row).Formula = Buyin
End If
If Sheets("Tourney Info").Range("J" & Row).Formula < DateMod Then
Sheets("Tourney Info").Range("J" & Row).Formula = DateMod
End If
If Sheets("Tourney Info").Range("K" & Row).Formula < BuyinMo
Then
Sheets("Tourney Info").Range("K" & Row).Formula = BuyinMod
End If
If Sheets("Tourney Info").Range("L" & Row).Formula < FieldMo
Then
Sheets("Tourney Info").Range("L" & Row).Formula = FieldMod
End I

--
TheIrishThu
-----------------------------------------------------------------------
TheIrishThug's Profile: http://www.excelforum.com/member.php...fo&userid=2968
View this thread: http://www.excelforum.com/showthread.php?threadid=49542

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default error passing a formula to a cell from a string

Hi,
Try these changes:

buyin = "='Tourney Info'!D" & Row & "/'Tourney Info'!E" & Row & ""
buyinmod = "=LN('Tourney Info'!G" & Row & "/100+1)"
FieldMod = "='Tourney Info'!E" & Row & "/10-'Tourney Info'!E" & Row & _
"^2/20000"
Datemid = "=36/(MONTH(NOW())-('Tourney Info'!B" & _
"+12*(YEAR(NOW())-('Tourney Info!'C" & Row & "+36)"


HTH

"TheIrishThug" wrote:


buyin, buyinmod, datemod, and fieldmod r all strings. the following are
4 expample of formulas i am trying to pass, but am getting
"application-defined or object defined" errors.
can anyone see where my mstake is?


Buyin = "=(Sheets(""Tourney Info"").Range(""D" & Row &
""").Value)/(Sheets(""Tourney Info"").Range(""E" & Row & """).Value)"
BuyinMod = "=LN((Sheets(""Tourney Info"").Range(""G" & Row &
""").Value)/100+1)"
FieldMod = "=(Sheets(""Tourney Info"").Range(""E" & Row &
""").Value)/10-(Sheets(""Tourney Info"").Range(""E" & Row &
""").Value)^2/20000"
DateMid = "=36/(MONTH(NOW())-(Sheets(""Tourney Info"").Range(""B" &
Row & """).Value)+12*(YEAR(NOW())-(Sheets(""Tourney Info"").Range(""C" &
Row & """).Value))+36)"

If Sheets("Tourney Info").Range("G" & Row).Formula < Buyin Then
Sheets("Tourney Info").Range("G" & Row).Formula = Buyin
End If
If Sheets("Tourney Info").Range("J" & Row).Formula < DateMod Then
Sheets("Tourney Info").Range("J" & Row).Formula = DateMod
End If
If Sheets("Tourney Info").Range("K" & Row).Formula < BuyinMod
Then
Sheets("Tourney Info").Range("K" & Row).Formula = BuyinMod
End If
If Sheets("Tourney Info").Range("L" & Row).Formula < FieldMod
Then
Sheets("Tourney Info").Range("L" & Row).Formula = FieldMod
End If


--
TheIrishThug
------------------------------------------------------------------------
TheIrishThug's Profile: http://www.excelforum.com/member.php...o&userid=29682
View this thread: http://www.excelforum.com/showthread...hreadid=495427


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default error passing a formula to a cell from a string

XL has no idea what to do with "Sheets(""Tourney Info"").Range("D" &
Row...". References need to be resolved outside the quoted string.

Try:

Buyin = "=" & Sheets("Tourney Info").Range("D" & Row).Value & _
"/" & Sheets("Tourney Info").Range("E" & Row).Value


or, a bit more efficiently:

With Sheets("Tourney Info")
Buyin = "=" & .Range("D" & Row).Value & _
"/" & .Range("E" & Row).Value
BuyinMod = "=LN(" & .Range("G" & Row) & "/100+1)"
'etc
End With

In article ,
TheIrishThug
wrote:

buyin, buyinmod, datemod, and fieldmod r all strings. the following are
4 expample of formulas i am trying to pass, but am getting
"application-defined or object defined" errors.
can anyone see where my mstake is?


Buyin = "=(Sheets(""Tourney Info"").Range(""D" & Row &
""").Value)/(Sheets(""Tourney Info"").Range(""E" & Row & """).Value)"
BuyinMod = "=LN((Sheets(""Tourney Info"").Range(""G" & Row &
""").Value)/100+1)"
FieldMod = "=(Sheets(""Tourney Info"").Range(""E" & Row &
""").Value)/10-(Sheets(""Tourney Info"").Range(""E" & Row &
""").Value)^2/20000"
DateMid = "=36/(MONTH(NOW())-(Sheets(""Tourney Info"").Range(""B" &
Row & """).Value)+12*(YEAR(NOW())-(Sheets(""Tourney Info"").Range(""C" &
Row & """).Value))+36)"

If Sheets("Tourney Info").Range("G" & Row).Formula < Buyin Then
Sheets("Tourney Info").Range("G" & Row).Formula = Buyin
End If
If Sheets("Tourney Info").Range("J" & Row).Formula < DateMod Then
Sheets("Tourney Info").Range("J" & Row).Formula = DateMod
End If
If Sheets("Tourney Info").Range("K" & Row).Formula < BuyinMod
Then
Sheets("Tourney Info").Range("K" & Row).Formula = BuyinMod
End If
If Sheets("Tourney Info").Range("L" & Row).Formula < FieldMod
Then
Sheets("Tourney Info").Range("L" & Row).Formula = FieldMod
End If

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default error passing a formula to a cell from a string


thanks to both of you. and i found how xl writes references to di
worksheets, so i'm good to go

--
TheIrishThu
-----------------------------------------------------------------------
TheIrishThug's Profile: http://www.excelforum.com/member.php...fo&userid=2968
View this thread: http://www.excelforum.com/showthread.php?threadid=49542

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
Passing Cell Address (String or Range) ExcelMonkey[_190_] Excel Programming 6 March 16th 05 05:11 PM
Passing a String in Array to Range as String [email protected] Excel Programming 2 September 1st 04 01:13 AM
string passing to DLL Christoph Wirz Excel Programming 1 February 20th 04 02:40 PM
PASSING A STRING VALUE Sirron Excel Programming 2 August 26th 03 06:40 PM
Create a formula into a String then assign string to a cell Myrna Larson[_2_] Excel Programming 6 August 23rd 03 09:42 PM


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