Teodorico Levoff
Teodorico Levoff

Reputation: 1659

Excel Setting a variable to be a

I have like 3 columns in a spreadsheet. They are Body, First Name, and Last Name. For example:

Body               First Name                  Last Name                        

Dear $var etc... Jon Doe
Dear $var etc... Jane Doe

What I want is for $var to be the concatenation with a space of the first name on current row plus a space plus the last name on the same row.

Basically the body in the end should be appear to be "Dear Jon Doe" and "Dear Jane Doe". I hope I made myself clear enough. Please ask questions for further clarification.

Upvotes: 1

Views: 30

Answers (2)

user4039065
user4039065

Reputation:

dim str as string
str = replace(range("A2"), "var$", range("B2") & chr(32) & range("C2"))
'do something with str

Upvotes: 0

Bond
Bond

Reputation: 16311

Assuming your first row is row 2, you'd enter the following worksheet function in A2:

="Dear "&B2&" "&C2

Upvotes: 3

Related Questions