Excel 2010 VBA macro to change the content of a module in another file

前端 未结 1 406
-上瘾入骨i
-上瘾入骨i 2021-01-06 19:55

I have developed a macro to mass update files in a file location. Im using the following code, which works perfectly, however the Edit part of the script requires changes in

相关标签:
1条回答
  • 2021-01-06 20:19

    While it is possible to modify your code by using code, it is not a very good practice to use (see here and here for some references, if you insist). Instead, it would be better to store the value in a more mutable location and reference it from there, or just capture it as input from the user.

    You could read in the data from a text file that is stored in a common and unlikely-to-change location, though this adds an extra level of complication. Instead, I would suggest just creating a hidden column or hidden worksheet that you can reference in the code. Either could even be locked and protected if you wanted, rather than just hidden.

    The advantage to using a hidden sheet or column is that the data is attached to the workbook (an external file is not), and it can also persist changes between sessions. You can update the value in that field, so that the next time you access the file it remembers the last one you used.

    0 讨论(0)
提交回复
热议问题