Amend existing macro to select a different address string if first string could not be found

Swaroon

Active Member
Joined
Nov 18, 2005
Messages
288
Office Version
  1. 365
Hi,
I have a macro which is used by different users, has been working for years with no issues but now, due to an IT change, different users have been given different network addresses which I can't get to be changed so all have the same path.

In order for the code to run for all users,

One user will need the code written as N:\Capital Leasing\Operations\etc
Another user will need the code as N:\Operations\etc

Is there any code that I can insert that would say if
N:\Capital Leasing\Operations\etc
could not be found, then use
N:\Operations\etc ?

Thanks
Steve
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
So you are just saying the mapping of 'N' is different for different users? Maybe this:

Code:
pth = "N:\Capital Leasing\Operations"
fld = Dir(pth, vbDirectory)
If Len(fld) = 0 Then pth = "N:\Operations"
 
Upvote 0
So you are just saying the mapping of 'N' is different for different users? Maybe this:

Code:
pth = "N:\Capital Leasing\Operations"
fld = Dir(pth, vbDirectory)
If Len(fld) = 0 Then pth = "N:\Operations"



Thanks for your help, worked great
 
Upvote 0

Forum statistics

Threads
1,223,702
Messages
6,173,936
Members
452,539
Latest member
delvey

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