Macro to select a file path from desktop

witsonjoyet

Board Regular
Joined
Sep 13, 2013
Messages
100
Good Day,

I have a macro which useful for creating a dashboard. Now the problem is i have to send that excel sheet to my boss. Whenever i send to these macro enabled excel sheets to my boss it does not work properly at my boss system. Problem is the path. For example in my macro its like the following

Sub OpenImp()
Dim owb As Workbook
Dim sh As Worksheet
Dim lr As Long
Dim rng As Range
Dim msgb As String

msgb = MsgBox("Do You Wanna import Daily Turnover Data?", vbYesNo, "Question?")
If msgb = vbYes Then
Set sh = Sheet2
Set owb = Workbooks.Open("C:\Documents and Settings\SYSTEM2\Desktop\book1.xlsx")

lr = Range("A" & Rows.Count).End(xlUp).Row
Set rng = Union(Range("A2:C" & lr), Range("F2:K" & lr))
rng.Copy sh.Range("A" & Rows.Count).End(xlUp)(2)
owb.Close False 'Close opened workbook don't save
End If
End Sub


every time i have to change this path (Red font in above) . Is there any way to save this macro on desktop automatically in any system?

Please suggest me
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,215,730
Messages
6,126,528
Members
449,316
Latest member
sravya

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