Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default VB doesn't like this Formula?

I don't understand why vb doesn't like this formula. Please help me
see what I am overlooking...

Dim Last_Column As Range
Set Last_Column = Worksheets(sName).Range("T2:T10")

Last_Column.Formula = "=IF(OR(" _
AND(" & Min_Limit & "<=Q2," & Max_Limit & "=Q2), _
AND(" & Min_Limit & "<=R2," & Max_Limit & "=R2), _
AND(" & Min_Limit & "=Q2," & Max_Limit & "<=R2)),1,0)"

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 290
Default VB doesn't like this Formula?

double quotations needed? ("""")

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default VB doesn't like this Formula?

Where?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default VB doesn't like this Formula?

Where? What's the difference between single and double?

Thanks

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default VB doesn't like this Formula?

^ Please disregard the previous comment. It looks like there was a lag
in posting that comment.

Thanks Tom and Bob!



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VB doesn't like this Formula?


When trying to write a formula to a cell you need to double up on your
quotations

Last_Column.Formula = "=IF(OR(*""* _
AND(*""* & Min_Limit & *""*<=Q2,"" & Max_Limit & *""*=Q2), _
AND(*""* & Min_Limit &* ""*<=R2,*"" *& Max_Limit &* ""*=R2), _
AND(*""* & Min_Limit & *""*=Q2,*""* & Max_Limit & *""*<=R2)),1,0)"


When it puts the Formula in the cell it will remove the additional
quotes. remember only double quotes for the formula that will be in the
cell not around the formula. Hope THis Helps


--
Xiazer
------------------------------------------------------------------------
Xiazer's Profile: http://www.excelforum.com/member.php...o&userid=31581
View this thread: http://www.excelforum.com/showthread...hreadid=542483

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default VB doesn't like this Formula?

Ok, I changed to the following, but I'm still getting an error...?

Last_Column.Formula = "=IF(OR( _
AND("" & RF_Min_Limit & ""<=Q2,"" & RF_Max_Limit & ""=Q2), _
AND("" & RF_Min_Limit & ""<=R2,"" & RF_Max_Limit & ""=R2), _
AND("" & RF_Min_Limit & ""=Q2,"" & RF_Max_Limit & ""<=R2)),1,0)"

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default VB doesn't like this Formula?

I don't think it is double quotes that you need as I think Min_Limit and
Max_Limit are numbers.

Try

Dim Last_Column As Range
Set Last_Column = Worksheets(sname).Range("T2:T10")

Last_Column.Formula = "=IF(OR(" & _
"AND(" & Min_Limit & "<=Q2," & Max_Limit & "=Q2)," & _
"AND(" & Min_Limit & "<=R2," & Max_Limit & "=R2)," & _
"AND(" & Min_Limit & "=Q2," & Max_Limit & "<=R2)),1,0)"

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"DISMfish" wrote in message
oups.com...
Ok, I changed to the following, but I'm still getting an error...?

Last_Column.Formula = "=IF(OR( _
AND("" & RF_Min_Limit & ""<=Q2,"" & RF_Max_Limit & ""=Q2), _
AND("" & RF_Min_Limit & ""<=R2,"" & RF_Max_Limit & ""=R2), _
AND("" & RF_Min_Limit & ""=Q2,"" & RF_Max_Limit & ""<=R2)),1,0)"



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default VB doesn't like this Formula?

Thanks, that did it!

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default VB doesn't like this Formula?

Thanks, that did it!



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default VB doesn't like this Formula?

Thanks, that did it!

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default VB doesn't like this Formula?

You can't put a continuation character inside a string

s = "ABC _
EFG"

doesn't work.

s = "ABC" & _
"EFG"

--
Regards,
Tom Ogilvy


"DISMfish" wrote:

Ok, I changed to the following, but I'm still getting an error...?

Last_Column.Formula = "=IF(OR( _
AND("" & RF_Min_Limit & ""<=Q2,"" & RF_Max_Limit & ""=Q2), _
AND("" & RF_Min_Limit & ""<=R2,"" & RF_Max_Limit & ""=R2), _
AND("" & RF_Min_Limit & ""=Q2,"" & RF_Max_Limit & ""<=R2)),1,0)"


  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default VB doesn't like this Formula?

Last_Column.Formula = "=IF(OR(" & _
"AND(" & Min_Limit & "<=Q2," & Max_limit & "=Q2)," & _
"AND(" & Min_Limit & "<=R2," & Max_limit & "=R2)," & _
"AND(" & Min_Limit & "=Q2," & Max_limit & "<=R2)),1,0)"

HTH
--
AP

"DISMfish" a écrit dans le message de news:
...
I don't understand why vb doesn't like this formula. Please help me
see what I am overlooking...

Dim Last_Column As Range
Set Last_Column = Worksheets(sName).Range("T2:T10")

Last_Column.Formula = "=IF(OR(" _
AND(" & Min_Limit & "<=Q2," & Max_Limit & "=Q2), _
AND(" & Min_Limit & "<=R2," & Max_Limit & "=R2), _
AND(" & Min_Limit & "=Q2," & Max_Limit & "<=R2)),1,0)"



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
Regression Leverage Formula (Jerry W. Lewis or Mike Middleton)already have DFITS formula PJ[_3_] Excel Worksheet Functions 2 June 2nd 10 03:45 PM
Commenting custom formula fields/formula on formula editor Muxer Excel Programming 2 July 24th 03 01:02 AM


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