Jun 22 2021 01:29 AM
When running this code, the error appears "the variable of the object or the variable of the block with has not been defined.".
The code was running fine and suddenly this error starts to appear.
What could be wrong? Thank you for your help.
Jun 22 2021 04:31 AM - edited Jun 22 2021 04:32 AM
SolutionThe most probable explanation that you have a table (ListObject) that consists only of the header row - no data rows have been added yet. In that situation, its DataBodyRange will be Nothing, causing the error you see. You can prevent this by adding a check:
If Not T.DataBodyRange Is Nothing Then
With T.DataBodyRange
...
End With
End If
Jun 24 2021 02:30 AM
Jun 22 2021 04:31 AM - edited Jun 22 2021 04:32 AM
SolutionThe most probable explanation that you have a table (ListObject) that consists only of the header row - no data rows have been added yet. In that situation, its DataBodyRange will be Nothing, causing the error you see. You can prevent this by adding a check:
If Not T.DataBodyRange Is Nothing Then
With T.DataBodyRange
...
End With
End If