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
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