We’d like to remind Forumites to please avoid political debate on the Forum.

This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.

📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide

No Excel Queries for a while - Here's One !

Hi All, hope someone can help with this:

In my Excel 2000 spreadsheet I have a column of check boxes in cells A6 : A206 and these are linked to cells B6:B206 to produce a TRUE in cell B6 when check box in A6 is checked and so on down to A206/B206.

What I really want is a total of 25 columns of check boxes in columns A, C, E, G etc through to column AW, with correspopnding TRUEs in columns B, D, F, H through to column AX.

I can copy 'n' paste the check boxes alright, but the only way I can make the links to the 'linked' cells is 'longhand' by right clicking the checkbox and typing in the cell ref I want. I don't, however, feel enthusiastic about doing this 25 x 200 times.

Does any one know a way of copying 'n' pasting the checkboxes where the 'linked' cell is automatically updated to the new cell - like when I copy 'n paste a formula the cell references in that are updated automatically to be appropriate to the new location.

thanks in advance

:beer:

Comments

  • Here's a macro I knocked up:
    Sub CreateCheckboxes()
        'Creates checkboxes on the current sheet in A6 to A206 linked to adjacent cell, i.e. B6 to B206.
        'Repeats this for every other column, i.e. C, E, G to AW
        
        Application.ScreenUpdating = False
            
        For c = Columns("A").Column To Columns("AW").Column Step 2
            For r = 6 To 206
            
                ' Create the checkbox
                With Cells(r, c)
                    ActiveSheet.CheckBoxes.Add(.Left, .Top, .Width, .Height).Select
                End With
                 
                Selection.Text = ""
                
                ' Set linked cell to adjacent cell
                Selection.LinkedCell = Cells(r, c + 1).Address
            Next
        Next
        
    End Sub
    
    Test it on an empty worksheet. Note that Excel will shoot up to 99% CPU and will say 'Not responding' while the macro is running. This is normal - give it a minute or so to finish, depending on how fast your computer is.
  • jghal
    jghal Posts: 129 Forumite
    Absolutely fantastic

    thank you very very much

    :beer:
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 353.5K Banking & Borrowing
  • 254.2K Reduce Debt & Boost Income
  • 455.1K Spending & Discounts
  • 246.6K Work, Benefits & Business
  • 603K Mortgages, Homes & Bills
  • 178.1K Life & Family
  • 260.6K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16K Discuss & Feedback
  • 37.7K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.