Macro not retrieving cell data

Barry Schwarz 3,746 Reputation points
2023-06-01T22:33:03.59+00:00

I have been staring at this too long and am obviously missing something stupid. Can someone tell me why the macro is not getting the data from cell Y13 ("Mixed") while the immediate print command has no problem?

Picture1

Picture1

?

Picture1

Microsoft 365 and Office Excel For business Windows
{count} votes

1 answer

Sort by: Most helpful
  1. Tanay Prasad 2,250 Reputation points
    2023-06-02T06:11:19.1966667+00:00

    Hi,

    The image you have attached is no longer available so I'm not able to refer to what you're saying.

    But, if your macro is not retrieving cell data in Excel, there could be a few possible reasons and troubleshooting steps you can try:

    1. Check the cell references: Ensure that the macro is referencing the correct cells. Double-check the cell addresses in your code to make sure they match the cells you want to retrieve data from.
    2. Check for errors: Review your macro code for any syntax errors or logical mistakes that could prevent data retrieval. Look for typos, missing brackets, or incorrect function usage. Use the debugging tools in the VBA editor to step through your code and identify any issues.
    3. Ensure cells are not empty: Check if the cells you are trying to retrieve data from actually contain values. If the cells are empty, the macro will retrieve empty values.
    4. Test with a simple code snippet: Create a minimalistic macro that retrieves data from a single cell to isolate the issue. Run this simplified macro and check if it retrieves the expected data.
    5. Consider workbook protection: If the workbook you are working with is protected, it may restrict access to certain cells or sheets. Check if the workbook is protected and if necessary, remove the protection temporarily to test your macro.

    If none of these steps resolve the issue, please provide more details about your macro code or any specific error messages you are encountering like "cannot open or run macro", "unable to record macro", etc.

    Refer here as well- https://www.wallstreetmojo.com/get-cell-value-in-excel-vba/

    Best Regards.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.