How to concatenate an integer to a variable

Brad24

Board Regular
Joined
May 4, 2015
Messages
81
Hi, I have a variable that I need to keep adding a number to in a for loop.

So I want Temp1=value and then Temp2=value and then Temp3=value

How would I go about something like that?

I tried things like "Temp" & i

Temp & i

but I'm on the wrong track....ugh
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi Brad24, which scenario are you trying to accomplish:

1. Adding values to get a FINAL result. Meaning: 2 + 2 + 2 = 6 (final value)
2. Adding values to get a FINAL number. Meaning: 2 + 2 + 2 = 222 (final number)

Please advise.
 
Upvote 0
I'm sorry but you can't use that syntax to refer to variables.

If you do have multiple variables Temp1, Temp2 etc have you considered an array?

Code:
Dim Temps(1 To 10)

   Temps(1) = 10
   Temps(2) = 20
   ' etc
 
Upvote 0

Forum statistics

Threads
1,214,520
Messages
6,120,017
Members
448,936
Latest member
almerpogi

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