Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Command Button Color


Suppose I have a spreadsheet that does a number of calculations. I hav
a command button which I use to execute the solutions.

1. I would like the button to turn green (or some color) when th
solution has converged, which I can check at any time

2. If a change to any parameter is made (and thus the former solutio
is not a solution for the new case) I would like to change the color
to red for example.

i would appreciate it if someone could help me figure out how t
accomplish this, particularly the second part.


Thank yo

--
justbrewi
-----------------------------------------------------------------------
justbrewit's Profile: http://www.excelforum.com/member.php...fo&userid=3753
View this thread: http://www.excelforum.com/showthread.php?threadid=57179

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Excel Command Button Color

if the solution is arrived at through iterative calculations in a single
calculation event, then you can not take actions inside that event.

If you code performs the calculations, then just add code to color the
button based on the conditions within your code.

--
Regards,
Tom Ogilvy


"justbrewit" wrote:


Suppose I have a spreadsheet that does a number of calculations. I have
a command button which I use to execute the solutions.

1. I would like the button to turn green (or some color) when the
solution has converged, which I can check at any time

2. If a change to any parameter is made (and thus the former solution
is not a solution for the new case) I would like to change the color,
to red for example.

i would appreciate it if someone could help me figure out how to
accomplish this, particularly the second part.


Thank you


--
justbrewit
------------------------------------------------------------------------
justbrewit's Profile: http://www.excelforum.com/member.php...o&userid=37539
View this thread: http://www.excelforum.com/showthread...hreadid=571792


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Command Button Color


This is fairly straight forward if you use VBE and a User Defined Form.
Is that the case or are you using the buttons from the worksheet tool?


--
raypayette


------------------------------------------------------------------------
raypayette's Profile: http://www.excelforum.com/member.php...o&userid=29569
View this thread: http://www.excelforum.com/showthread...hreadid=571792

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Excel Command Button Color

Option Explicit
Private Sub CommandButton1_Click()
'your code to do all the work here
if somethinggoodhappened = true then
Me.CommandButton1.BackColor = &HFF00&
else
me.commandbutton1.backcolor = &HFF&
end if
End Sub


justbrewit wrote:

Suppose I have a spreadsheet that does a number of calculations. I have
a command button which I use to execute the solutions.

1. I would like the button to turn green (or some color) when the
solution has converged, which I can check at any time

2. If a change to any parameter is made (and thus the former solution
is not a solution for the new case) I would like to change the color,
to red for example.

i would appreciate it if someone could help me figure out how to
accomplish this, particularly the second part.

Thank you

--
justbrewit
------------------------------------------------------------------------
justbrewit's Profile: http://www.excelforum.com/member.php...o&userid=37539
View this thread: http://www.excelforum.com/showthread...hreadid=571792


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Command Button Color


Thanks for the help, but I am not sure that I am being totally clear.

After I run the VB code and find a solution to my equations, can I
(somehow) change the button color if any cell in the workbook is
modified by the user?


--
justbrewit
------------------------------------------------------------------------
justbrewit's Profile: http://www.excelforum.com/member.php...o&userid=37539
View this thread: http://www.excelforum.com/showthread...hreadid=571792



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Excel Command Button Color

If any cell is changed in the workbook????

This code goes behind the ThisWorkbook module:

Option Explicit
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Me.Worksheets("sheet2").OLEObjects("commandbutton1 ").Object.BackColor _
= &HFF&
End Sub

Change the sheet name and the commandbutton name to match.

justbrewit wrote:

Thanks for the help, but I am not sure that I am being totally clear.

After I run the VB code and find a solution to my equations, can I
(somehow) change the button color if any cell in the workbook is
modified by the user?

--
justbrewit
------------------------------------------------------------------------
justbrewit's Profile: http://www.excelforum.com/member.php...o&userid=37539
View this thread: http://www.excelforum.com/showthread...hreadid=571792


--

Dave Peterson
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
change the face color of an Excel command button Chris Leah Excel Discussion (Misc queries) 5 April 21st 23 09:03 AM
Change color of command button dhstein Excel Discussion (Misc queries) 1 May 21st 09 01:08 AM
VB's Command Button vs Form's Command Button Ronald Dodge Excel Programming 3 May 24th 06 02:23 PM
Command Button Color For Next Loop John Wilson Excel Programming 3 September 15th 05 05:57 PM
command button color mark kubicki Excel Programming 1 August 13th 04 05:29 PM


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