Question

As an alternative to global variable, I am trying to read the last value I worked on at start up. I read this: Excel VBA: Workbook_Open, and this. and tried to implement my own. But it is not doing anything at the moment.

Private Sub Workbook_Open()

    MsgBox "Testing.."

End Sub

I noticed when I paste the following code into my project, it is in the general, instead of in the worksheet. I don't know if that's the problem, I already have a method that listen to changed in my worksheet.

Edit: This is the screen I am at right now... enter image description here

Edit: I see what happened. ****I must open view > Project Exloper > This Workbook **** in order to click on ThisWorkbook. Thank you for your help!

Was it helpful?

Solution

I think you've probably put this code in the wrong module.

It needs to go in "ThisWorkbook" section of the project.

Just double click on "ThisWorkbook" in the Project explorer window in the VBA editor and paste your code into that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top