+ Reply to Thread
Results 1 to 12 of 12

Check boxes macro

Hybrid View

Colhawk Check boxes macro 10-04-2012, 05:39 AM
Colhawk Re: Check boxes macro 10-09-2012, 11:56 AM
jaslake Re: Check boxes macro 10-09-2012, 01:36 PM
Colhawk Re: Check boxes macro 10-10-2012, 11:33 AM
jaslake Re: Check boxes macro 10-10-2012, 01:13 PM
Colhawk Re: Check boxes macro 10-16-2012, 06:49 AM
jaslake Re: Check boxes macro 10-16-2012, 10:28 AM
bakerman2 Re: Check boxes macro 10-16-2012, 03:31 PM
  1. #1
    Registered User
    Join Date
    10-04-2012
    Location
    Taunton, England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Check boxes macro

    is that a no one????

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Check boxes macro

    Hi Colhawk

    Please attach a file that represents what you have. The structure of your attachment should be the same structure as your actual data. Any proprietary information should be changed.

    Include in the attachment any code you're currently using (whether it works or not).
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    10-04-2012
    Location
    Taunton, England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Check boxes macro

    Hi,

    Thanks for the reply jaslake. I have uploaded a copy of the spreadsheet that I use.
    Attached Files Attached Files

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Check boxes macro

    Hi Colhawk

    Try this...let me know of issues
    Sub CheckBox19_Click()
        Dim oCheck As Object
        Set oCheck = Sheet1.CheckBoxes("Check Box 19")
        If oCheck.Value = 1 Then
            Range("D2").FormulaR1C1 = _
                    "=+IF(R[20]C[-2]="""","""",VLOOKUP(R[20]C[-2],'Payment list'!R[1]C[-3]:R[31]C[-2],2))"
            Range("D3").Select
        Else
            Range("D2").Value = ""
        End If
    End Sub

  5. #5
    Registered User
    Join Date
    10-04-2012
    Location
    Taunton, England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Check boxes macro

    Hi jaslake,

    Thanks for that solution. It works well for the first 3 people on the timesheet but upon the fourth person when I click the check box it comes up with an error saying "Runtime error 1004. The item with the specified name wasn't found"

    I have checked that the checkbox is definitely named Check Box 22 (even cut and paste this in to make sure it was right) but still cannot seem to see why it isnt working, the line it has problems with is coloured in red below.


    Sub CheckBox22_Click()
        Dim oCheck As Object
        Set oCheck = Sheet1.CheckBoxes("Check Box 22")    
    If oCheck.Value = 1 Then
            Range("D4").FormulaR1C1 = _
                    "=+IF(R[18]C[-2]="""","""",VLOOKUP(R[18]C[-2],'Payment list'!R[1]C[-3]:R[31]C[-2],2))"
            Range("D5").Select
        Else
            Range("D4").Value = ""
        End If
    End Sub
    Thanks for any help you can give!
    Last edited by Cutter; 10-17-2012 at 06:58 PM. Reason: Added code tags

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Check boxes macro

    Hi Colhawk

    First, please wrap your code in code tags.

    Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    As to your issue...I don't know...there's something that's different. If you'll post the offending file one of us will look at it.

    BUT FIRST, please wrap your code in code tags (Rule #3 explains how to do so).

  7. #7
    Registered User
    Join Date
    10-04-2012
    Location
    Taunton, England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Check boxes macro

    Hi jaslake

    Thanks again for helping.

    Sorry here is the code for the fourth check box

    Sub CheckBox22_Click()
    Dim oCheck As Object
    Set oCheck = Sheet1.CheckBoxes("Check Box 22") 
    If oCheck.Value = 1 Then
    Range("D5").FormulaR1C1 = _
    "=+IF(R[17]C[-2]="""","""",VLOOKUP(R[17]C[-2],'Payment list'!R[1]C[-3]:R[31]C[-2],2))"
    Range("D6").Select
    Else
    Range("D5").Value = ""
    End If
    End Sub
    As i said, for some reason, the first 3 work, and the only thing I have changed is the check box name to the correct one and also the range value in the actual IF formula.
    Attached Files Attached Files

+ Reply to Thread

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