VBA - List all variable names and their values during run-time

howCome

New Member
Joined
Mar 21, 2012
Messages
1
hi Everyone,

Do you know how to list all the class module variables along with their "current" values during run-time?

This is similar to lookup the variables on the watch panel during run-time, but I am trying to list all of them to a worksheet using VBA.

Maybe I am not using a good enough keyword, but the best I can find on the internet is http://www.mrexcel.com/forum/showthread.php?t=502112
But Zack Barresse's solution is just to list all the variables defined in the module, not to list their values during run-time (Please correct me if I am wrong).



The reason that I am doing this:
I have around 20-30 public variables sitting in some class modules. Differnt subs/functions would change those variables. I want to see what values those variable have at different stages, so I wrote a "status" sub to print out the variable names and their value, and call this "status" sub in other subs/functions. However, this is not the ideal way to do as I have to hard code all the variable names in this "status" sub and I need to add/remove/re-arrange those variables very often, which is a problem.

Any suggestions/solutions/hints would be highly appreciated.

Thank you all in advance!!
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,214,863
Messages
6,121,978
Members
449,058
Latest member
oculus

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top