Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 296
Default How dio I attach a variable to an Operator:= ?

Hi,

I have within a procedure the following code. I set the variables
sRed, SOrange etc. earlier in the procedure, and would also like to
set the Operator:= blah, blah as a variable. I've tried passing it as
a string and variant variable but to no avail.

Can anyone help me out please?

i.e how can I get the bit following the Operator:= to recognise a
variable.?

Usual TIA.

With rMyrange.FormatConditions
.Add Type:=xlCellValue, Operator:=xlLess, Formula1:=sRed
.Add Type:=xlCellValue, Operator:=xlLess,Formula1:=sOrange
.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:=sGreen
End With

__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default How dio I attach a variable to an Operator:= ?

Richard,
This works (or you set Opval to 6 = xlLess/ 5 = XlGreater))
opVal = xlLess

With rMyrange.FormatConditions
.Add Type:=xlCellValue, Operator:=opVal, Formula1:=sRed
.Add Type:=xlCellValue, Operator:=xlLess, Formula1:=sOrange
.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:=sGreen
End With


HTH

"Richard Buttrey" wrote:

Hi,

I have within a procedure the following code. I set the variables
sRed, SOrange etc. earlier in the procedure, and would also like to
set the Operator:= blah, blah as a variable. I've tried passing it as
a string and variant variable but to no avail.

Can anyone help me out please?

i.e how can I get the bit following the Operator:= to recognise a
variable.?

Usual TIA.

With rMyrange.FormatConditions
.Add Type:=xlCellValue, Operator:=xlLess, Formula1:=sRed
.Add Type:=xlCellValue, Operator:=xlLess,Formula1:=sOrange
.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:=sGreen
End With

__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 296
Default How dio I attach a variable to an Operator:= ?

Hi,

Thanks Toppers,

One supplementary please, I need to set the Type as well. Forgot to
mention this last time :-(

It's either
..Add Type:=xlExpression
or
..Add Type:=xlCellValue

What are the equivalent numbers for these please?
And how do you establish them?

Regards


On Thu, 27 Oct 2005 09:06:02 -0700, "Toppers"
wrote:

Richard,
This works (or you set Opval to 6 = xlLess/ 5 = XlGreater))
opVal = xlLess

With rMyrange.FormatConditions
.Add Type:=xlCellValue, Operator:=opVal, Formula1:=sRed
.Add Type:=xlCellValue, Operator:=xlLess, Formula1:=sOrange
.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:=sGreen
End With


HTH

"Richard Buttrey" wrote:

Hi,

I have within a procedure the following code. I set the variables
sRed, SOrange etc. earlier in the procedure, and would also like to
set the Operator:= blah, blah as a variable. I've tried passing it as
a string and variant variable but to no avail.

Can anyone help me out please?

i.e how can I get the bit following the Operator:= to recognise a
variable.?

Usual TIA.

With rMyrange.FormatConditions
.Add Type:=xlCellValue, Operator:=xlLess, Formula1:=sRed
.Add Type:=xlCellValue, Operator:=xlLess,Formula1:=sOrange
.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:=sGreen
End With

__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________


__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default How dio I attach a variable to an Operator:= ?

Richard,
XlCellValue=1 and xlExpression=2.

You can determine these by running through the code using F8 key and
highlighting the variable e.g xlCellValue.


opval = 6
Typeval = 1
With rMyrange.FormatConditions
.Add Type:=Typeval, Operator:=opval, Formula1:=sRed


HTH

"Richard Buttrey" wrote:

Hi,

Thanks Toppers,

One supplementary please, I need to set the Type as well. Forgot to
mention this last time :-(

It's either
..Add Type:=xlExpression
or
..Add Type:=xlCellValue

What are the equivalent numbers for these please?
And how do you establish them?

Regards


On Thu, 27 Oct 2005 09:06:02 -0700, "Toppers"
wrote:

Richard,
This works (or you set Opval to 6 = xlLess/ 5 = XlGreater))
opVal = xlLess

With rMyrange.FormatConditions
.Add Type:=xlCellValue, Operator:=opVal, Formula1:=sRed
.Add Type:=xlCellValue, Operator:=xlLess, Formula1:=sOrange
.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:=sGreen
End With


HTH

"Richard Buttrey" wrote:

Hi,

I have within a procedure the following code. I set the variables
sRed, SOrange etc. earlier in the procedure, and would also like to
set the Operator:= blah, blah as a variable. I've tried passing it as
a string and variant variable but to no avail.

Can anyone help me out please?

i.e how can I get the bit following the Operator:= to recognise a
variable.?

Usual TIA.

With rMyrange.FormatConditions
.Add Type:=xlCellValue, Operator:=xlLess, Formula1:=sRed
.Add Type:=xlCellValue, Operator:=xlLess,Formula1:=sOrange
.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:=sGreen
End With

__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________


__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________

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
Operator for Contains Leanne M (Aussie) Excel Worksheet Functions 2 October 21st 08 11:01 AM
XOR Operator - How? Randy Brown Excel Discussion (Misc queries) 3 April 8th 06 09:47 PM
Mod operator R Avery Excel Programming 7 September 2nd 04 03:03 AM
Need help with the Like Operator DennisE Excel Programming 3 April 27th 04 11:47 PM
Can the AND operator be of use here? Milind Excel Programming 3 July 27th 03 11:17 PM


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