Hi, im tryng to convert my code from ActiveX Checkboxes to Wingdings "Checkboxes"
Thats the code im using for Wingdings
And this is the code that im tryng to convert
That's my failed attempt with error
Thats the code im using for Wingdings
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim i As Range
Set i = Intersect(Target, Range("Checkboxes"))
If Prev(i) = "PrevNo" Then
Exit Sub
End If
If Not i Is Nothing Then
Cancel = True
Application.EnableEvents = False
If i.Value = "þ" Then
i.Value = "¨"
i.Offset(0, 1).Value = "No"
'ToggleLock i.Row, False
Else
i.Value = "þ"
'ToggleLock i.Row, True
i.Offset(0, 1).Value = "Yes"
End If
Application.EnableEvents = True
End If
And this is the code that im tryng to convert
VBA Code:
Function Prev(chk As OLEObject)
Application.ScreenUpdating = False
Dim PrevValue As Variant
If TypeName(chk.Object) = "CheckBox" Then
PrevValue = chk.TopLeftCell.Offset(-1, 0).Value
If PrevValue = "0" Or IsEmpty(PrevValue) Then
chk.TopLeftCell.Offset(0, 0).Value = "Not Checked"
chk.Object = False
MsgBox "Not checked", vbExclamation, "WARNING"
Prev = "PrevNo"
Else
chk.TopLeftCell.Offset(0, 0).Value = "Checked"
chk.TopLeftCell.Offset(1, -2).Select
End If
End If
Application.ScreenUpdating = True
End Function
That's my failed attempt with error
Type mismatch (Error 13)
On string
VBA Code:
If TypeName(Range("Checkboxes")) Then
VBA Code:
Function Prev(i As Range)
Application.ScreenUpdating = False
Dim PrevValue As Variant
Set i = Range("Checkboxes")
If TypeName(Range("Checkboxes")) Then
PrevValue = i.Offset(-1, 0).Value
If PrevValue = "0" Or IsEmpty(PrevValue) Then
i.Offset(0, 0).Value = "Not Checked"
MsgBox "Not checked", vbExclamation, "WARNING"
Prev = "PrevNo"
Else
i.Offset(0, 0).Value = "Checked"
i.TopLeftCell.Offset(1, -2).Select
End If
End If
Application.ScreenUpdating = True
End Function