Results 1 to 7 of 7

How do I assign macro codes to multiple checkboxes

Threaded View

  1. #1
    Registered User
    Join Date
    01-11-2011
    Location
    cleveland ohio
    MS-Off Ver
    Excel 2007
    Posts
    16

    How do I assign macro codes to multiple checkboxes

    Hello, I have written my code already for my first check box. My goal is to click a checkbox, and it moves the data to the right. When Unchecked it(the macro) moves the data to where it was in the first place. Please see the code for checkbox 1 below.

    Private Sub CheckBox1_Click()
    Select Case CheckBox1.Value
        Case True
            ActiveSheet.Range("k6:k6").Cut
            ActiveSheet.Range("M6").Select
            ActiveSheet.Paste
        Case False
            ActiveSheet.Range("m6:m6").Cut
            ActiveSheet.Range("k6").Select
            ActiveSheet.Paste
    End Select
    
    
    End Sub
    I have about a 1000 checkboxes. I am trying to figure out a way to tell excel that I want the same code (different cells) for all my other checkboxes without me manually writing the code over and over again. I am using Excel 2007

    My next checkboxes when checked would have to move cell contents

    from K:7 to m7 and then back when unchecked
    from K:8 to m8
    from K:9 to m9 and so forth on so on all the way to 1000

    Thank you very much. Eagerly awaiting your response. I have spent half of my workday on this problem.
    Last edited by spamunch; 01-18-2011 at 02:58 PM.

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