user3752758
user3752758

Reputation: 35

Input formula with string concatenation through VBA

No doubt the solution is probably right under my nose, but after spending hours messing with this I give up. I have a workaround which is not acceptable. Here is the formula straight out of the spreadsheet:

="https://www.google.com/maps/?z=12&t=k&q="&D2&"'"&C2

Here is the VBA code for which I get errors whatever I seem to do with it.

 ActiveCell.FormulaR1C1 = "="""https://www.google.com/maps/?z=12&t=k&q="""&D2&"" '""&C2"

I would surely appreciate it if someone could help. I don't normally have too much difficulty with concatenation, but, this one has got me and there is no doubt some simple trick I am overlooking. Thanks in advance.

Upvotes: 2

Views: 74

Answers (1)

Scott Craner
Scott Craner

Reputation: 152450

You want .Formula when dealing with A1 notation.

And only "" on each end of the website string.

use this:

ActiveCell.Formula = "=""https://www.google.com/maps/?z=12&t=k&q=""&D2&""'""&C2"

Upvotes: 3

Related Questions