Consulting

Results 1 to 4 of 4

Thread: Solved: Change the state of cell by clicking on it

  1. #1
    VBAX Regular
    Joined
    Jul 2008
    Posts
    43
    Location

    Solved: Change the state of cell by clicking on it

    I am curious if there is a way to have the state of a cell change just by clicking on it. (i.e. change from a false state to a true state)
    I know that I can change it by entering a value but was looking for a way that by selecting the cell it would display a check mark or remove it just by clicking on it.

  2. #2
    VBAX Master CreganTur's Avatar
    Joined
    Jan 2008
    Location
    Greensboro, NC
    Posts
    1,676
    Location
    If you're wanting to add in a checkbox, you can do that via the CheckBox tool on the Forms toolbar.
    -Randy Shea
    I'm a programmer, but I'm also pro-grammar!
    If your issue is resolved, please use Thread Tools to mark your thread as Solved!

    PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003


  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]


    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Const WS_RANGE As String = "H1:H10" '<=== change to suit

    On Error GoTo err_handler
    Application.EnableEvents = False
    If Not Application.Intersect(Target, Range(WS_RANGE)) Is Nothing Then
    With Target
    .Font.Name = "Marlett"
    Select Case .Value
    Case "": .Value = "a"
    Case "a": .Value = ""
    End Select
    .Offset(0, 1).Select
    End With
    End If
    err_handler:
    Application.EnableEvents = True
    End Sub
    [/vba]

    This is worksheet event code, which means that it needs to be
    placed in the appropriate worksheet code module, not a standard
    code module. To do this, right-click on the sheet tab, select
    the View Code option from the menu, and paste the code in.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    VBAX Regular
    Joined
    Jul 2008
    Posts
    43
    Location
    Thanks for the replies.

Posting Permissions

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