Error 91 - Object variable not set

Hi all,

I've just started to learn about coding in VBA and I have an error in the following code that I don't know how to resolve.

I want to use a CheckBox, the first part If block is working as it should but the second one is not.

When I run the code the error 91 appear saying "Object Variable or With block variable not set".

ActiveSheet.Range("A10:A30").Find("Mr. G").Select

Does anyone know how to resolve this issue ?

Thank you !

Private Sub CheckBox1_Click()

If CheckBox1.Value = True Then
ActiveSheet.Range("A10:A30").Find("").Select

Range(ActiveCell, ActiveCell.Offset(0, 2)).BorderAround _
ColorIndex:=1, Weight:=xlThin
Range(ActiveCell, ActiveCell.Offset(0, 2)).Merge
Range("A10:C10").BorderAround _
ColorIndex:=1, Weight:=xlMedium

ActiveCell.Value = "Mr. G"
ActiveCell.Font.Name = "Arial"
Range(ActiveCell, ActiveCell.Offset(0, 2)).HorizontalAlignment = xlCenter
Range(ActiveCell, ActiveCell.Offset(0, 2)).VerticalAlignment = xlCenter

End If

If CheckBox1.Value = False Then
ActiveSheet.Range("A10:A30").Find("Mr. G").Select
ActiveCell.ClearContents

End If

End Sub

Hello,

merged cells are sources of all kinds of difficulties.

My proposal to fix your issue.

ActiveSheet.Range("A10:C30").Find("Mr. G").Select
Search for threads similar to "error object variable set"