object variable or with block variable not set excel vba code example Example: System.NullReferenceException: 'Object variable or With block variable not set.' Dim x As String