I playing with some code where I want to set up a list of values, that can then be picked up in a loop. The loop works fine but what's being written to the spreadsheet is wrong.
The code:
What I was expecting was the car names to appear, but what I'm getting is "Franchise1" etc. Is there a way for the code to recognize that when "Franchise" = Franchise1 it should print "Audi"?
The code:
Code:
Sub Macro3()
'
Dim Franchise1 As String
Dim Franchise2 As String
Dim Franchise3 As String
Franchise1 = "Audi"
Franchise2 = "BMW"
Franchise3 = "Ford"
Dim Franchise As String
Dim Number As Integer
Number = 1
Do
Dim NumberString As String
NumberString = Number
Franchise = "Franchise" + NumberString
Range("A" + NumberString).Select
ActiveCell.FormulaR1C1 = Franchise
Number = Number + 1
Loop Until Number = 4
End Sub