+ Reply to Thread
Results 1 to 2 of 2

Macro Linking Checkboxes to Cells with Relative References instead of Absolute

  1. #1
    Registered User
    Join Date
    10-18-2007
    Posts
    3

    Macro Linking Checkboxes to Cells with Relative References instead of Absolute

    Hello all,

    I am just learning VBA code and I came across the following macro:

    Please Login or Register  to view this content.
    It is pretty neat--It adds a checkbox (of the "forms toolbar" type) and links it to each cell that has been selected. The check boxes when clicked turn their linked cells yellow. It really increases user-friendliness.

    The only complaint I have is that the checkboxes end up being linked to absolute cell references. I want to be able to sort and filter my data and keep the checkboxes with their rows even when I move them around.

    Is there any way to do this? I was hoping someone could very quickly modify the above code to produce this result.

    I am also open to any other easier method that someone could suggest.

    Thanks in advance,
    Nick

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Nick,

    All Worksheet controls, whether Forms or Control Toolbox types, are drawn on the worksheet, and linked to a cell by the Upper Left Corner of the control which intersects with it. This is how Excel knows where the control is. Unfortunately, these controls aren't shifted when a Range they are attached to is sorted. To do what you want would require writing a specialized sort macro in VBA.

    Sincerely,
    Leith Ross

+ 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