Cell Value Needs To Replace String

drmingle

Board Regular
Joined
Oct 5, 2009
Messages
229
Code:
Const strURI As String = "http://www.google.com/#sclient=psy&hl=en&safe=active&source=hp&q=site:+squidoo.com+%22space saver treadmill%22&aq=f&aqi=&aql=&oq=&pbx=1&bav=on.2,or.r_gc.r_pw.&fp=d69918eb06677aa8"

This code snippet deals with one single hard-coded http, but I need the code to reference values in a cell.

I thought I could do Range(A2), but I have been unsuccessful. I am not sure if it has to do with " " or not...
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Code:
[B][COLOR=red]Const[/COLOR][/B] strURI As String = "http://www.google.com/#sclient=psy&hl=en&safe=active&source=hp&q=site:+squidoo.com+%22space saver treadmill%22&aq=f&aqi=&aql=&oq=&pbx=1&bav=on.2,or.r_gc.r_pw.&fp=d69918eb06677aa8"

This code snippet deals with one single hard-coded http, but I need the code to reference values in a cell.

I thought I could do Range(A2), but I have been unsuccessful. I am not sure if it has to do with " " or not...

You've dimmed it as a constant, so therefore it must be constant (cannot contain variables)...

Try changing that all to

Rich (BB code):
Dim StrURI As String
StrURI =  "http://www.google.com/#sclient=psy&hl=en&safe=active&source=hp&q=site:+squidoo.com+%22space saver treadmill%22&aq=f&aqi=&aql=&oq=&pbx=1&bav=on.2,or.r_gc.r_pw.&fp=d69918eb06677aa8"

Then you can start concatenating the string using Range("A1").Value or whatever.
 
Upvote 0
Code:
StrURI = "http://www.google.com/#sclient=psy&hl=en&safe=active&source=hp&q=site:+squidoo.com+%22" [B][COLOR=Red]& Range(A2) &[/COLOR][/B] "%22&aq=f&aqi=&aql=&oq=&pbx=1&bav=on.2,or.r_gc.r_pw.&fp=d69918eb06677aa8"

The section in "red" is what I have added, but I am getting a 1004 error global fail...

Any suggestions.
 
Upvote 0

Forum statistics

Threads
1,224,516
Messages
6,179,231
Members
452,898
Latest member
Capolavoro009

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