reggie86
reggie86

Reputation: 289

Insert variable value into cell with text VBA

I'm trying to insert the number contained by the variable Row4Num -1 into the Active Cell, along with some text, but I can't quite figure out the syntax. Any help would be greatly appreciated-- Thanks!

      Range("I7").Value = "=""Teams:  & "" Row4Num - 1"

Upvotes: 3

Views: 34992

Answers (1)

Scott Craner
Scott Craner

Reputation: 152450

This:

Range("I7").Value = "Teams:  " & Row4Num - 1

When using VBA variables in a String they must be outside the "" and concatenated with &. Everything inside the quotes will be treated as a text string.

Upvotes: 9

Related Questions