Refesh data connection based on Network URL Sheet "Website"

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,561
Office Version
  1. 2021
Platform
  1. Windows
I have a spreasheet that is updated by selecting Refresh Data and the data is imported into sheet "Data"

I have the Network address on sheet "Website" in cell A1

I would like a macro to refresh the data based on the Website address on sheet "Website' in Cell A1 so that if this changes, the data will refresh based on the correct address on my network for eg http://172.35.45.94/Reports/Accounts Receivable/Dec 2022


Your assistance is most appreciated
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
I have come up with this code to refresh the data

[code[ Sub RefreshData()

With Sheets("Data").QueryTables.Add(Connection:="http://172.35.45.94/Reports/Accounts Receivable.cfm?monthreported=" & Sheets("Macro").Range("a1"), Destination:=Range("$A$1"))
End With
End Sub [/code]


However, when running the macro, I get a run time error 1004 "Appliction-defined or object-defined error


It would be appreciated if someone could kindly amend my code
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,755
Members
448,989
Latest member
mariah3

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