Ian
Ian

Reputation: 4467

VBA not setting cell text in excel spreadsheet

I have the following line of code in my VBA code that I use to automatically set the text of a cell in an excel worksheet.

Sheets(checkout_sheet_name).Cells(Row_Index, checkout_tool_observation_column).Value = status

This same logic used to execute in my old spreadsheet just fine, but now I've transferred the module over to a new spreadsheet and it no longer works. The line executes with proper values for all the variables. Does anyone have any idea why this line of code would simply execute without actually setting the value of the cell to the text I see displayed in the debugger?

Thx.

Upvotes: 0

Views: 483

Answers (2)

Ian
Ian

Reputation: 4467

The problem ended up being that the column I was writing to was collapsed somehow and one of the buttons I made would cover it when I tried to expand it. I'm not really sure why this happened, but when I transitioned my logic over to yet another new spreadsheet it went away.

Upvotes: 0

PatricK
PatricK

Reputation: 6433

Since we do not know what comes before that line of code, you may want to debug.print the address of that cell and the status to support it did execute but no values set.

Debug.Print Now() & vbTab & Sheets(checkout_sheet_name).Cells(Row_Index, checkout_tool_observation_column).Address & " -> " & status

Upvotes: 1

Related Questions