ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Command Button Color For Next Loop (https://www.excelbanter.com/excel-programming/340186-command-button-color-next-loop.html)

John Wilson

Command Button Color For Next Loop
 
I can get this to work:
(using "x" as an integer variable)

activesheet.oleobjects("Commandbutton" & x).visible = true

but this doesn't:

activesheet.oleobjects("Commandbutton" & x).forecolor = vbRed

Any ideas on how to change the CommandButton color in a For/Next
loop with a variable?

Thanks,
John



Bob Phillips[_6_]

Command Button Color For Next Loop
 
ActiveSheet.OLEObjects("Commandbutton" & x).Object.ForeColor = vbRed


--
HTH

Bob Phillips

"John Wilson" wrote in message
...
I can get this to work:
(using "x" as an integer variable)

activesheet.oleobjects("Commandbutton" & x).visible = true

but this doesn't:

activesheet.oleobjects("Commandbutton" & x).forecolor = vbRed

Any ideas on how to change the CommandButton color in a For/Next
loop with a variable?

Thanks,
John





John Wilson

Command Button Color For Next Loop
 

"Bob Phillips" wrote in message
...
ActiveSheet.OLEObjects("Commandbutton" & x).Object.ForeColor = vbRed


--
HTH

Bob Phillips

"John Wilson" wrote in message
...
I can get this to work:
(using "x" as an integer variable)

activesheet.oleobjects("Commandbutton" & x).visible = true

but this doesn't:

activesheet.oleobjects("Commandbutton" & x).forecolor = vbRed

Any ideas on how to change the CommandButton color in a For/Next
loop with a variable?

Thanks,
John







John Wilson

Command Button Color For Next Loop
 
Bob,

Sometimes it's the simplest things that trip you up.

Thanks for the help.

John

"Bob Phillips" wrote in message
...
ActiveSheet.OLEObjects("Commandbutton" & x).Object.ForeColor = vbRed


--
HTH

Bob Phillips

"John Wilson" wrote in message
...
I can get this to work:
(using "x" as an integer variable)

activesheet.oleobjects("Commandbutton" & x).visible = true

but this doesn't:

activesheet.oleobjects("Commandbutton" & x).forecolor = vbRed

Any ideas on how to change the CommandButton color in a For/Next
loop with a variable?

Thanks,
John








All times are GMT +1. The time now is 03:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com