Modify VBA with VBA

MrKowz

Well-known Member
Joined
Jun 30, 2008
Messages
6,653
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hey all,

I have read the article by Chip Pearson (http://www.cpearson.com/Excel/vbe.aspx), and I have a question that isn't quite touched on in there.

Is it possible to edit a specific line in a module through a procedure? I am leaving the company I am with at the end of the week, and I am trying to build the most effective way for my employer to continue to use a program I have written (whose code has several areas that is dependent on the naming convention of the workbooks that are opened).

It WOULD be possible for me to go through the code and adapt it for the workbook name through a variable, but I simply don't have time to accomplish this.

Basically, I need to change the following to a specific inputbox value
Module: Sheet1
  • Line 9, Col 72 through Line 9, Col 80
  • Line 21, Col 57 through Line 21, Col 65
  • Line 32, Col 85 through Line 32, Col 93
In each of those line/columns, I am effectively changing the word "Template" to the inputbox value (variable length). I just don't know how to specifically change those lines through VBA.

If I can get a solution to this, I am confident I can build the solution for other modules.

Thanks in advance!
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
In any case, I'm not convinced of the usefulness of the line, col editing in code. Too risky in a scripted environment like VBA - one line changes and it's all garbage. Maybe (at least) rewrite the entire module so that you can be sure of the outcome.

BTW - good links. I guess we all know about Chip Pearson's site but didn't realize Erlandsen consulting has some pages on this too.
 
Upvote 0

Forum statistics

Threads
1,225,149
Messages
6,183,177
Members
453,151
Latest member
Lizamaison

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