Code:
Dim rol1, rol2, rol3, _
rol4, rol5, rol6 As String
makes 5 Variants, and 1 string. (The method you used works in C and in
VB.NET.) You need to use
Code:
Dim rol1 As String, rol2 As String, rol3 As String, _
Code:
rol4 As String, rol5 As String, rol6 As String
' or
Dim rol1 As String
Dim rol2 As String
Dim rol3 As String
Dim rol4 As String
Dim rol5 As String
Dim rol6 As String
To do this you must make an array, and use k as the index. You cannot use dynamic variable names. After compilation variables do not have names at all. During the compilation process, the names are used to load a token table, which is then incorporated into the .EXE. Therefore there is nothing to find through concatenating rol with the value of k.
Code:
Dim rol(1 To 6) As String
Code:
rol(1) = "Piet"
rol(2) = "Mike"
rol(3) = "Sandra"
rol(4) = "Eveline"
rol(5) = "Wim"
rol(6) = "RFN"
For k = 1 To UBound(rol)
ws0.[B1].Offset(0, k - 1).Value = rol(k)
Next