Macro and VBA variable locations

BennieC

New Member
Joined
Jul 23, 2010
Messages
8
Hi,
Now that i can create macros and place results anywhere I have another challenge. Invariably my spreadsheets change,so locations move. How can my macros, which now refer to specific locations be told to find there source data at the new locations, without editing?

I have also created some functions which I call for complex calculations. I have loaded them as add-ins, but moving the program between computers requires me to always, on the specific computer, reload the call in the cells - am I doing something wrong?
Bennie
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

bobsan42

Well-known Member
Joined
Jul 14, 2010
Messages
1,855
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
Platform
  1. Windows
Are you looking for something like:
ThisWorkbook.Path
or
ActiveWorkbook.Path
About Addins:
place the XLA file in:
"%userprofile%\Application Data\Microsoft\AddIns"
and enable the Addin (Tools -> Addins...) - then the macros and functions should be working normally
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,519
Messages
5,837,824
Members
430,517
Latest member
chessypack86

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
Top