![]() |
Command Button
Hello I want to create a command button that will change the font color of the active cell to a specific color but that is only allowed for a range of cells not the whole worksheet. Thanks for any help. -- CoronaSTX ------------------------------------------------------------------------ CoronaSTX's Profile: http://www.excelforum.com/member.php...o&userid=27958 View this thread: http://www.excelforum.com/showthread...hreadid=474581 |
Command Button
Hi CoronaSTX,
Assuming the button to be a Control Toolbox command button, try: '============= Private Sub CommandButton1_Click() Dim rng As Range Set rng = Range("A1:H20") '<<====== Change If Not Intersect(rng, ActiveCell) Is Nothing Then With ActiveCell.Font If .ColorIndex = 3 Then .ColorIndex = xlAutomatic Else .ColorIndex = 3 End If End With End If End Sub '<<============= Change the address of the rng variable to accord with that of your range of interest. Change the ColorIndex value from 3 (red) to suit your requirements. --- Regards, Norman "CoronaSTX" wrote in message ... Hello I want to create a command button that will change the font color of the active cell to a specific color but that is only allowed for a range of cells not the whole worksheet. Thanks for any help. -- CoronaSTX ------------------------------------------------------------------------ CoronaSTX's Profile: http://www.excelforum.com/member.php...o&userid=27958 View this thread: http://www.excelforum.com/showthread...hreadid=474581 |
Command Button
Hi Norman Jones, Thanks so much your reply, it worked perfectly. :) I have another question. How would I create a command button to insert a row only in a certain range of cells or lets say only between A19 and A80 a user could insert a row but not before or A19 or after A80. Again thanks for any help. -- CoronaSTX ------------------------------------------------------------------------ CoronaSTX's Profile: http://www.excelforum.com/member.php...o&userid=27958 View this thread: http://www.excelforum.com/showthread...hreadid=474581 |
Command Button
How would I create a command button to insert a row only in a certain range of cells or lets say only between A19 and A80 a user could insert a row but not before or A19 or after A80. Again thanks for any help. -- CoronaSTX ------------------------------------------------------------------------ CoronaSTX's Profile: http://www.excelforum.com/member.php...o&userid=27958 View this thread: http://www.excelforum.com/showthread...hreadid=474581 |
Command Button
Something like:
With ActiveCell If .Row = 18 And .Row <=80 Then .EntireRow.Insert End With -- Vasant "CoronaSTX" wrote in message ... How would I create a command button to insert a row only in a certain range of cells or lets say only between A19 and A80 a user could insert a row but not before or A19 or after A80. Again thanks for any help. -- CoronaSTX ------------------------------------------------------------------------ CoronaSTX's Profile: http://www.excelforum.com/member.php...o&userid=27958 View this thread: http://www.excelforum.com/showthread...hreadid=474581 |
All times are GMT +1. The time now is 12:16 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com