G
Guest
I modified the following code to loop thru rows 2 to 5.
The strInitial won’t reset to take the value of the next row, It’ll remain
showing the value of the first row for as many times there are in N, all the
other variables reset to the next N.
Any suggestions?
For N = 2 To 5 'rows
For i = 0 To UBound(myArray)
If myArray(i) > 0 Then
'Concatenate array values with column values to create a range for the
replacement string
strToReplace = "[" & myArray(i) & "]" 'Create string to be replaced from
array value
strRange = myArray(i) & N 'column and row
strReplacement = Range(strRange) 'Create the replacement string
'Replace existing string with replacment string
strInitial = Replace(strInitial, strToReplace, strReplacement, 1, 1) 'not
looping thru row
Else
i = UBound(myArray)
End If
Next i
MsgBox strInitial 'MsgBox displays the new string
Next N
The strInitial won’t reset to take the value of the next row, It’ll remain
showing the value of the first row for as many times there are in N, all the
other variables reset to the next N.
Any suggestions?
For N = 2 To 5 'rows
For i = 0 To UBound(myArray)
If myArray(i) > 0 Then
'Concatenate array values with column values to create a range for the
replacement string
strToReplace = "[" & myArray(i) & "]" 'Create string to be replaced from
array value
strRange = myArray(i) & N 'column and row
strReplacement = Range(strRange) 'Create the replacement string
'Replace existing string with replacment string
strInitial = Replace(strInitial, strToReplace, strReplacement, 1, 1) 'not
looping thru row
Else
i = UBound(myArray)
End If
Next i
MsgBox strInitial 'MsgBox displays the new string
Next N