A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Dear @Heather Brock,
Thank you for posting your question in the Microsoft Q&A forum.
Based on the provided information, I understand the issue might be related to VBA. This usually indicates one of the following VBA‑related reasons:
- The VBA code is referencing the wrong cells or empty cells
If the cell references for amounts or invoice numbers are incorrect (e.g., wrong column, wrong sheet, wrong range), VBA will return 0 because numbers default to zero when the referenced cell is empty.
- The VBA variables for amounts/invoice numbers are declared as the wrong data type
If variables are declared incorrectly (e.g., as Integer instead of String or Variant), Excel may convert empty or non‑numeric values to 0.
- The lookup function (e.g., Find, VLOOKUP, Match) is failing
If VBA cannot locate the correct row or lookup value for invoice number/amount but can find customer name, the numeric fields may be returning nothing, which VBA displays as 0.
- The values are formatted as text, not numbers
If the invoice number or amount is stored as text in the worksheet, but the VBA code expects numeric values, the code may fail to read them.
- A missing worksheet, changed table layout, or shifted columns
If the spreadsheet was modified after the VBA was written (extra column added, sheet renamed), the code may still run—but return zeros for numeric fields because it is pulling from the wrong location.
To diagnose accurately, I need to see how the VBA code is written and what the source data looks like.
Could you please provide one of the following?
- A screenshot related to the issue
- A copy of the VBA code you are running
- A short screen recording (if possible) showing the issue
This information will help identify whether the problem is caused by:
- incorrect cell references,
- variable types,
- lookup failures, or changes in the worksheet structure.
I am looking forward to your response.
If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.