A VBA method that stops working is almost always one of four things: the object the method is called on is not what you think it is, the arguments are wrong for that method, the code is running in the wrong context (a different workbook, sheet or application), or the project has a broken reference or a security setting blocking it. The fastest fix is to stop the line at the failure point with a breakpoint, inspect the object in the Locals window, and confirm the method exists on that exact object type. The steps below walk through that diagnosis in order, from the simplest checks to the ones that require editing the project.

What You'll Need

  • Access to the VBA editor in the host application (Alt+F11 in most Office desktop apps).
  • The macro or procedure that fails, ideally with the exact line that errors.
  • The error number and message, if one appears.
  • Permission to edit the workbook or document and to change macro security settings if needed.
  • A copy of the file to test on, so a mistake does not cost you the original.

Step-by-Step

  1. Reproduce the failure deliberately. Run the macro and note the exact error number and message. If no error appears but nothing happens, add Debug.Print statements or step through the code with F8 so you can see which line is skipped. A method that silently does nothing is usually a method called on an empty or wrong object, not a syntax problem.
  2. Turn on error handling so you can see the real line. In the VBA editor, go to Tools > Options > General and make sure Break on All Errors is selected while you debug. If the procedure has an On Error Resume Next line near the top, comment it out temporarily. That line hides the failure and is one of the most common reasons a method appears not to work.
  3. Set a breakpoint on the failing line. Click in the left margin next to the line, or place the cursor there and press F9. Run the macro. When execution pauses, hover over the object variable before the dot in the method call. If the tooltip says Nothing or Empty, the object was never set and the method cannot run.
  4. Check the object type in the Locals window. Open View > Locals. Expand the object you are calling the method on. Confirm it is the type the method expects, for example a Worksheet rather than a Range, or a ListObject rather than a ListRow. Calling a method that belongs to a different object type produces error 438, "Object doesn't support this property or method."
  5. Confirm the method exists on that object. With the object variable typed in the code window, type a dot after it and wait for the drop-down list. If the method is not in the list, it does not exist for that object, or the reference library that provides it is missing. This single check resolves a large share of "method not working" reports.
  6. Verify the arguments. Press Ctrl+J or open the Object Browser (F2) and search for the method name to see its required parameters. Missing required arguments, arguments in the wrong order, or a string passed where a number is expected will all fail. Named arguments (for example Name:=) make order mistakes obvious.
  7. Check the parent object's state. A method can fail because the sheet is protected, the workbook is read-only, the range is empty, or the document is in a mode that blocks edits. Unprotect the sheet manually and retry. If it then works, the macro needs to unprotect and reprotect around the call, with the password handled carefully rather than hard-coded in plain text.
  8. Look for missing references. In the VBA editor go to Tools > References. Any entry marked "MISSING:" at the top of the list will break methods that depend on it. Note which library is missing, then either re-enable it, browse to the correct file, or rewrite the code to use late binding so the reference is not required. Labels in this dialog vary slightly by Office version and installed components.
  9. Test in a clean context. Close and reopen the host application, then run the macro in a new blank file with a minimal copy of the failing procedure. If it works there, the problem is in the original file: a name conflict, a protected project, or a corrupted module. Export the modules, import them into a fresh file, and test again.
  10. Check macro security and trust settings. If macros are disabled or the file came from another location, the code may not run at all. Open the Trust Center in the host application's options and review the macro settings and trusted locations. Only enable macros in files you trust; do not lower security settings permanently just to make one file run.

Common Mistakes

  • Leaving On Error Resume Next active, which turns a hard failure into silence and makes the method look broken.
  • Assuming a variable is set because it was declared. Declaration does not create the object; only Set does.
  • Using the wrong collection index or name, so the method runs on a different item than intended and appears to do nothing.
  • Forgetting that screen updating or calculation settings were turned off earlier in the macro, so the result is correct but invisible.
  • Editing a copy of the file while running the macro from another copy, then wondering why changes do not appear.
  • Copying code from a forum without checking which application and library version it was written for.

Tips

  • Use TypeName on the object in the Immediate window to confirm exactly what you are working with.
  • Keep a short error handler that logs the error number, description and line, then re-raises the error during development.
  • Use Option Explicit at the top of every module so undeclared variables are caught before they cause odd behaviour.
  • Prefer named arguments in method calls; they document intent and prevent order mistakes.
  • Test one change at a time. Changing several lines between runs makes it impossible to tell which fix worked.

Troubleshooting

If the method still fails after the steps above, work from the error outward. Error 438 means the method does not exist on that object; recheck the object type and the reference list. Error 91 means the object variable is Nothing; trace where it should have been set. Error 1004 is a broad application-level error and usually points to a protected sheet, an invalid range, or a file state problem rather than the method itself. Error 424 means a required object is missing from the call.

If no error appears at all, add a message box immediately after the method call to confirm the line is reached. If it is reached and nothing changes, check whether the target is hidden, filtered, or on a different sheet than the one you are viewing. If the macro works on one machine but not another, compare the References list and the Office bitness (32-bit versus 64-bit) on both; Declare statements and some libraries differ between them.

If the project itself will not open or the code is locked, the file may have a password-protected VBA project. You cannot bypass that protection; ask the file's owner for the password or obtain an unprotected copy. Do not use tools that strip project passwords.

Frequently Asked Questions

Why does my VBA method work in one workbook but not another?

The most common causes are a missing reference in the second workbook, a protected sheet or workbook, or a name conflict with another procedure. Compare Tools > References in both files first.

What does "Object doesn't support this property or method" mean?

The object you are calling the method on is not the type that has that method. Confirm the object's type with TypeName and check the method in the Object Browser.

Why does my macro run without any error but do nothing?

Usually an On Error Resume Next line is hiding the failure, or the method is acting on a hidden sheet, an empty range, or a different workbook than the one on screen.

Can a missing reference stop a method from working?

Yes. A reference marked MISSING in Tools > References can break methods that depend on that library. Re-enable it, point it to the correct file, or switch to late binding.

Why does the same macro fail on a 64-bit Office install?

Declare statements for Windows API calls need the PtrSafe keyword and correct pointer types on 64-bit Office. Methods that rely on those declarations will fail until they are updated.

Is it safe to lower macro security to make a method run?

No. Keep macro security at its normal level and only enable macros in files you trust. If a file needs a lower setting to run, treat that as a warning sign and verify the file's source.