raphagcwill
New Member
- Joined
- Jan 12, 2016
- Messages
- 41
Hi there,
wondering if you can help to change the VAB I wil post below so that it only adds a checkbox if the imediate cell to it's left contains text. If no text is found not checkbox should be inserted.
Thanks in advance
Sub InsertCheckBoxes()
'Update 20140506
Dim Rng As Range
Dim WorkRng As Range
Dim Ws As Worksheet
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Set Ws = Application.ActiveSheet
Application.ScreenUpdating = False
For Each Rng In WorkRng
With Ws.CheckBoxes.Add(Rng.Left, Rng.Top, Rng.Width, Rng.Height)
.Characters.Text = Rng.Value
End With
Next
WorkRng.ClearContents
WorkRng.Select
Application.ScreenUpdating = True
End Sub
wondering if you can help to change the VAB I wil post below so that it only adds a checkbox if the imediate cell to it's left contains text. If no text is found not checkbox should be inserted.
Thanks in advance
Sub InsertCheckBoxes()
'Update 20140506
Dim Rng As Range
Dim WorkRng As Range
Dim Ws As Worksheet
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Set Ws = Application.ActiveSheet
Application.ScreenUpdating = False
For Each Rng In WorkRng
With Ws.CheckBoxes.Add(Rng.Left, Rng.Top, Rng.Width, Rng.Height)
.Characters.Text = Rng.Value
End With
Next
WorkRng.ClearContents
WorkRng.Select
Application.ScreenUpdating = True
End Sub