Dear colleagues,
Since my last EXCEL VBA application passed two years and now I started the whole new project. I did already a lot of works and now I wanted to set some variables to be set on excel opening. So this is what I did: the userform is called "CACalc" and at the beginning I'm declaring variables:
I would like to have those two variables already set when the excel file is opened. I created then this method in the "ThisWorkbook" object:![]()
Please Login or Register to view this content.
When I run the project I receive the "Error 91, Object Variable or with block not set " in the shown line of above code. This can be solved if I change the variable "wb" type to "String", but I'd like to have it as "Workbook". What I'm missing? The goal is to use those two variables in the userForm code to get the data from the excel sheet:![]()
Please Login or Register to view this content.
And by the way: I get the error 9 in above code although the variables were correct . When I enter the object "Workbook(wb)." after pressing CTRL + SPACE I get the list of possible methods and object to select. However whatever I select "Worksheets" or "Sheets" followed by the index (e.g. Sheets(2) ) after the next '.' I don't have a list with other methods and objects. I was expecting "Range" or "Cell" available but I get nothing. I will appreciate you help.![]()
Please Login or Register to view this content.
Best regards,
Michal
Bookmarks