+ Reply to Thread
Results 1 to 2 of 2

check box

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-04-2006
    Posts
    117

    check box

    I made two macros. One that inserts an altered formula into a cell and one that puts that altered formula back to normal. Im trying to paste that into the checkbox code but its not reading the "put it back to normal" code, mainly becuase I think I have to insert code that identifies what to do if the checkbox is unchecked. How do I code to make the program acknowledge when the checkbox is unchecked so I can put that "put it back to normal" code after it.

    check box checked = altered cell
    check box unchecked = back to normal

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887
    Something like this should work, change your cell/range as needed:

    Private Sub CheckBox1_Click()
        If CheckBox1.Value = vbChecked Then
            Range("A3").Formula = "=A1+A2"
        Else
            Range("A3").Formula = "=A1*A2"
        End If
        
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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