LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 17
Default simplifying routine

I have the following procedure for a checkbox. The trouble is it feels very
cumbersome and long and I have to do it for each box; is there a shorter more
efficient way to do the same?

Private Sub CheckBox87_Click()
cellno = "f34"
If CheckBox87.Value = True Then
Me.Cells.Range(cellno).Font.Color = RGB(0, 255, 0)
Me.Cells.Range(cellno).Font.Bold = True
CheckBox88.Visible = False
Else: Me.Cells.Range(cellno).Font.Color = RGB(0, 0, 255)
Me.Cells.Range(cellno).Font.Bold = False
CheckBox88.Visible = True
End If

Because I need a large number of these boxes, I was thinking of a routine
such as;

For i = 1 to 200

If CheckBox(i).Value = True Then
Me.Cells.Range(cellno).Font.Color = RGB(0, 255, 0)
Me.Cells.Range(cellno).Font.Bold = True
CheckBox(i+1).Visible = False
Else: Me.Cells.Range(cellno).Font.Color = RGB(0, 0, 255)
Me.Cells.Range(cellno).Font.Bold = False
CheckBox(i+1).Visible = True
End If
next i

which would be a load easier than having to copy this the required number of
times for each checkbox. Can anybody guide me in the right direction please?

Many thanks in advance.

 
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
Ideas for simplifying cell formulas Takeadoe Excel Discussion (Misc queries) 4 May 12th 06 02:16 AM
Fast Fourier Transform routine in Tools add-in menu Tutorguy Excel Worksheet Functions 1 March 23rd 06 04:49 PM
Suppressing startup routine Mark Excel Discussion (Misc queries) 3 March 6th 06 01:19 PM
How to create a routine Tara Excel Discussion (Misc queries) 1 August 12th 05 02:28 AM
Convert Sub routine to Function [email protected] Excel Worksheet Functions 5 May 5th 05 12:50 PM


All times are GMT +1. The time now is 05:35 PM.

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"