Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Is there a more efficient way to do this?

I have a sheet with 28 checkbox controls on it. When a Highlight Changes
Button is selected a Public variable is set to true and any changes made to
the sheet are highlighted. I have a functional bit of code but am wondering
if there is a more efficient way to check for changes in each of the 28
checkboxes without having to enter this code 28 times.

Here is the functional code:

Private Sub CheckBox1_Change()
If blTrackChanges = True Then 'Check Public Variable blTrackChanges
If true then enable Highlight Modifications
CheckBox1.BackColor = &H80C0FF
End If
End Sub

Any ideas would be appreciated.

Thanks

Steve


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Is there a more efficient way to do this?

Put the code in a separate parameter driven macro, like so

Private Sub CheckBox1_Change()
Call CheckAny(CheckBox1)
End Sub

Private Sub CheckAny(cb As MSForms.CheckBox)
If blTrackChanges = True Then 'Check Public Variable blTrackChanges
'If true then enable Highlight Modifications
cb.BackColor = &H80C0FF
End If
End Sub


--
HTH

Bob Phillips

"Steve Roberts" wrote in message
...
I have a sheet with 28 checkbox controls on it. When a Highlight Changes
Button is selected a Public variable is set to true and any changes made

to
the sheet are highlighted. I have a functional bit of code but am

wondering
if there is a more efficient way to check for changes in each of the 28
checkboxes without having to enter this code 28 times.

Here is the functional code:

Private Sub CheckBox1_Change()
If blTrackChanges = True Then 'Check Public Variable blTrackChanges
If true then enable Highlight Modifications
CheckBox1.BackColor = &H80C0FF
End If
End Sub

Any ideas would be appreciated.

Thanks

Steve




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
Efficient linking teh_chucksta Excel Discussion (Misc queries) 3 April 18th 08 11:44 PM
What is more efficient Brad Excel Discussion (Misc queries) 2 November 20th 06 09:13 PM
More efficient way? Steph[_3_] Excel Programming 6 June 23rd 04 09:34 PM
Which is more efficient? Norm[_5_] Excel Programming 3 April 2nd 04 04:24 PM
Efficient Looping tehwa[_9_] Excel Programming 3 February 2nd 04 04:44 AM


All times are GMT +1. The time now is 01:28 AM.

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"