Beneindias
Board Regular
- Joined
- Jun 21, 2022
- Messages
- 120
- Office Version
- 365
- Platform
- Windows
- MacOS
Hello excel experts.
I'm trying to create a checkbox in column B, linked to column C, for each new row that I create in a table.
I have this VBA code that I'm testing and its a mix of recorded macro and code found on the internet:
this line:
.LinkedCell = Range("C", lastRow) is givin an error.
This code is working with a button just to test purposes, because the goal is to have it working every time I add a row to the table.
This code is creating the cell in the wrong place and not linked to the cell in column C.
How do I make this code work every time a row is added to that table?
How to properly create the checkbox in the right place?
And will it delete that checkbox if I delete a row?
In the print screen that I attached, I should have the checkbox in row 11, but it was created in row 12, with no cell linked.
Thanks to every one
I'm trying to create a checkbox in column B, linked to column C, for each new row that I create in a table.
I have this VBA code that I'm testing and its a mix of recorded macro and code found on the internet:
VBA Code:
Sub ButtonClick10()
Dim lastRow As Long
Dim sh As Worksheet
Set sh = Sheets("Salarios")
With sh
lastRow = .Cells(Rows.Count, "D").End(xlUp).Row
End With
With sh.Range("B" & lastRow)
With sh.CheckBoxes.Add(20.25, 147, 72, 72)
.Caption = ""
.Locked = False
.LockedText = False
.Value = xlOff
.LinkedCell = Range("C", lastRow)
End With
End With
End Sub
this line:
.LinkedCell = Range("C", lastRow) is givin an error.
This code is working with a button just to test purposes, because the goal is to have it working every time I add a row to the table.
This code is creating the cell in the wrong place and not linked to the cell in column C.
How do I make this code work every time a row is added to that table?
How to properly create the checkbox in the right place?
And will it delete that checkbox if I delete a row?
In the print screen that I attached, I should have the checkbox in row 11, but it was created in row 12, with no cell linked.
Thanks to every one