Excel Guides

Creating a String in a Macro in Excel

There are a few different ways that you can create a string in a macro in Excel. One way is to use the Dim statement. For example:

Dim myString As String
myString = "This is my string"

You can also use the Concat function to concatenate strings together. For example:

Dim myString As String
myString = Concat("This", " is ", "my ", "string")

If you want to create a string that contains variables, you can use the Format function. For example:

Dim myName As String, myAge As Integer, myString As String
myName = "John"
myAge = 30
myString = Format("My name is {0} and I am {1} years old.", myName, myAge)

Move beyond 


Get started with Causal today.
Build models effortlessly, connect them directly to your data, and share them with interactive dashboards and beautiful visuals.