Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default 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



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
command button add another command Wanna Learn Excel Discussion (Misc queries) 5 December 7th 08 11:42 PM
Command button CEG Excel Discussion (Misc queries) 1 May 4th 06 09:54 PM
Command Button wjd01 Excel Programming 2 January 22nd 04 06:57 PM
Command Button vs Control Button RGibson Excel Programming 1 October 14th 03 02:24 AM
Command Button vs Form Button T K Excel Programming 4 August 26th 03 07:26 PM


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