Results 1 to 4 of 4

Using ActiveX CheckBox Control to make a cell change colour and clear values

Threaded View

drmit Using ActiveX CheckBox... 08-19-2012, 07:25 PM
Cutter Re: Using ActiveX CheckBox... 08-19-2012, 08:59 PM
royUK Re: Using ActiveX CheckBox... 08-20-2012, 02:08 AM
drmit Re: Using ActiveX CheckBox... 08-20-2012, 04:18 AM
  1. #1
    Registered User
    Join Date
    08-19-2012
    Location
    NZ
    MS-Off Ver
    Excel 2010
    Posts
    5

    Using ActiveX CheckBox Control to make a cell change colour and clear values

    Hi everyone

    I'm a total noob at VBA so please be nice

    I'm developing a spreadsheet that has a series of ActiveX CheckBox controls.

    With one in particular, I'm trying to get the checkbox to control what is displayed in a particular cell. What I want is this:

    CheckBox checked: Change cell colour to red/pink, but only until a number is entered in it
    CheckBox unchecked: Change cell colour back to 'no fill', and clear any values already typed in.

    Here is the code I'm using:

    Private Sub CheckBox29_Click()
    Dim ChannelNo As Integer
        ChannelNo = Range("P50")
    If CheckBox29.Value = True Then
       If IsEmpty(ChannelNo) Then
       ChannelNo.Select
       Selection.Interior.Color = RGB(255, 67, 67)
       Else:
       ChannelNo.Select
       Selection.Color.Index = xlNone
       End If
    Else: ChannelNo = ""
    End If
    End Sub
    Please forgive the terrible flow of it all, as I said this is my first crack at this and the code has been cobbled together by reading a bunch of various posts, none of which I fully understand - my knowledge of syntax is next to nil at the moment, but I'm working on it!

    Cheers
    Last edited by Cutter; 08-19-2012 at 08:58 PM. Reason: Added code tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1