G
Glen
Hopefully someone will be able to provide me with an answer for this
one. I am having a lot of difficulty getting VBA to place check boxes
inside the linked cells. I believe the problem with the process is a
result of the varying size of the rows. Is there a way to place these
check box objects inside the appropriate cell without modifying the
spreadsheet layout?
I have created a spreadsheet which pulls most of its information from 3
different access databases. This data is presented in a spreadsheet at
the user's request. Now the end-user wants to add the check box in the
1st column (Lucky me) as an indicator for quality control. I am trying
to modify the spreadsheet as little as possible and as a result I am
trying to add these checkboxes at the end of processing the data when
the spreadsheet is formatted with "size-to-fit" cells. Below is the
process I am using to create the check boxes. It is a modification of
code I found earlier on this website and I am sorry but I didn't
bookmark the programmer to provide recognition in this post. Thank you
very much for any help you can provide.
Dim myCBX As CheckBox
Dim myCell As Range
Dim cntr As Integer
cntr = rowcount + 1
Columns("A:A").Select
With Selection
.Insert Shift:=xlToRight
.ColumnWidth = 6
End With
Columns("B").Select 'Formatting of header cells
With Selection 'cause me to delete these now
.Delete Shift:=xlToLeft
End With
With ActiveSheet
For Each myCell In Range("A6:A" & cntr & "")
Set ChkBox = ActiveSheet.CheckBoxes.Add _
(myCell.Left, myCell.Top, _
myCell.Width, myCell.Height)
ChkBox.LinkedCell = myCell.Address
ChkBox.Caption = ""
Next myCell
End With
one. I am having a lot of difficulty getting VBA to place check boxes
inside the linked cells. I believe the problem with the process is a
result of the varying size of the rows. Is there a way to place these
check box objects inside the appropriate cell without modifying the
spreadsheet layout?
I have created a spreadsheet which pulls most of its information from 3
different access databases. This data is presented in a spreadsheet at
the user's request. Now the end-user wants to add the check box in the
1st column (Lucky me) as an indicator for quality control. I am trying
to modify the spreadsheet as little as possible and as a result I am
trying to add these checkboxes at the end of processing the data when
the spreadsheet is formatted with "size-to-fit" cells. Below is the
process I am using to create the check boxes. It is a modification of
code I found earlier on this website and I am sorry but I didn't
bookmark the programmer to provide recognition in this post. Thank you
very much for any help you can provide.
Dim myCBX As CheckBox
Dim myCell As Range
Dim cntr As Integer
cntr = rowcount + 1
Columns("A:A").Select
With Selection
.Insert Shift:=xlToRight
.ColumnWidth = 6
End With
Columns("B").Select 'Formatting of header cells
With Selection 'cause me to delete these now
.Delete Shift:=xlToLeft
End With
With ActiveSheet
For Each myCell In Range("A6:A" & cntr & "")
Set ChkBox = ActiveSheet.CheckBoxes.Add _
(myCell.Left, myCell.Top, _
myCell.Width, myCell.Height)
ChkBox.LinkedCell = myCell.Address
ChkBox.Caption = ""
Next myCell
End With