VBA code with data connections

goldendroid

New Member
Joined
Sep 7, 2014
Messages
3
Trying to write macro for a data connection that changes from week to week. For example, web address would be ***week1 for first week and ***week2, etc. all the way to 52. In order to compensate for this, I was trying to put the week number in different cell and have the macro look at this cell and update the data connection accordingly. How is the macro written to do this? Portion of code is below. site replaced with *** to protect the innocent.

.Connection = _"URL;http://***week=1"

I've tried to replace 1 with "A1" and similar combinations but that doesn't work. Please help. I could copy and paste this 52 times for each week but I'd rather take the easy way. It's just I can't figure it out.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
.Connection = _"URL;http://***week=" & A1

THat isn't working for me. I've double checked the connection string after doing this and the string stops at week= and doesn't enter the value from A1. I've changed the quote to the end after A1 and string changes to week= & A1 as the text string and not capturing the cell value.
 
Upvote 0
sheets("A").range("A1")

or Dim update_value as string

update_value = sheets("A").range("A1")
 
Upvote 0

Forum statistics

Threads
1,214,527
Messages
6,120,057
Members
448,940
Latest member
mdusw

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