Hi VBA wizards,
I have what is probably an Excel/VBA 101 problem. But I don’t know what terms to Google to determine the solution.
I have a workbook where the first tab (“Sheet1”) is a form for users to fill out:
When you click the button, a Macro runs and useable data is generated on another tab (“Sheet2”):
Please Login or Register to view this content.
Pretty simple stuff.
Here’s the problem: Suppose after building the user interface on Sheet1, I realize that I have to redesign it, move some fields around, add a feature, etc:
The problem here is now the Macro’s hardcoded references to cells are now incorrect. I need to manually reread through every line of my code and make corrections. That’s not a huge problem with this toy example, but a massive pain when my actual spreadsheet at work has over 1,000 lines of VBA code and twenty tabs. (Really!)
There’s got to be a way to dynamically reference the user-edited fields in Sheet1 so that I can move them around without having to re-edit the VBA all the time. I noticed the “Define Name” option when I right-click on a cell. A “name” would seem to be what I need, but when I Google “excel vba cell name variable” or some subset of those words, I pull up a lot of information on named ranged or named variables, but nothing on cells.
Is there some way to do this? If so, what terminology should I search on? Thanks
Bookmarks