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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
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,217,388
Messages
6,136,306
Members
450,003
Latest member
AnnetteP

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