Copying and pasting lost of form control tick boxes

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Every one,

I have to copy a form control tick box about 200 times,
when i copy and paste it the cell link does not move so i have 200 tick boxes all pointing to cell D21
this is a one off thing so anyone know a way i can get the cell links to follow down the column
or amacro that can copy paste and change the cell link?
any ideas please
Thanks
Tony
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi, I tried to come up with something that would help and found this on mrexcel.com. I updated the code and included a link to the original thread so you can see other examples. This is for Checkboxes, I hope that is what you meant by tick boxes.

VBA Code:
Option Explicit
Sub forCreateCheckboxes()
    Dim ToRow As Long
    Dim MyLeft As Double
    Dim MyTop As Double
    Dim MyHeight As Double
    Dim MyWidth As Double
    Dim BoxesNeeded As Long
    Dim i
    '--------------------------
    'https://www.mrexcel.com/board/threads/add-checkboxes-through-vba-code.180887/
    
    BoxesNeeded = 20 'Update to the amount of boxes you want
    
    For i = 1 To BoxesNeeded
        Range("E" & i) = i 'Fills D1 with 1 to BoxesNeeded
    Next i
    
    For ToRow = 1 To BoxesNeeded
        If Not IsEmpty(Cells(ToRow, "E")) Then 'IF E row# has number, C row# gets a box
            '-
            MyLeft = Cells(ToRow, "C").Left
            MyTop = Cells(ToRow, "C").Top
            MyHeight = Cells(ToRow, "C").Height
            MyWidth = MyHeight = Cells(ToRow, "C").Width
            '-
            ActiveSheet.CheckBoxes.Add(MyLeft, MyTop, MyWidth, MyHeight).Select
             With Selection
                .Caption = ""
                .Value = xlOff
                '.LinkedCell = "D" & ToRow 'Uncomment if you want to see true or false in Column D
                .Display3DShading = False
            End With
        End If
    Next
 

Attachments

  • for CreateCheckboxes.jpg
    for CreateCheckboxes.jpg
    50.7 KB · Views: 5
Upvote 0

Forum statistics

Threads
1,214,923
Messages
6,122,286
Members
449,076
Latest member
kenyanscott

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top