I am trying to write a loop that will populate a group of named worksheet cells.
my code is
Private Sub Rate_Change()
'update rates when one is changed
Dim i, Text As String, newtext As String, Text2 As String, NewText2 As String, h
Text = "txtrate"
Text2 = "data!rate"
For i = 2 To 12
h = i & "a"
newtext = Text & h
NewText2 = Text2 & h
Me.Controls(newtext).Value = Format(Range(NewText2).Value, "0.00%")
Next i
End Sub
I get errors on:
Me.Controls(newtext).Value = Format(Range(NewText2).Value, "0.00%") :Could not find specified object.
I assume that the syntax is wrong for range(newtext2) but cannot figure out how to phrase correctly.
Any help would be most appreciated
Thanks
my code is
Private Sub Rate_Change()
'update rates when one is changed
Dim i, Text As String, newtext As String, Text2 As String, NewText2 As String, h
Text = "txtrate"
Text2 = "data!rate"
For i = 2 To 12
h = i & "a"
newtext = Text & h
NewText2 = Text2 & h
Me.Controls(newtext).Value = Format(Range(NewText2).Value, "0.00%")
Next i
End Sub
I get errors on:
Me.Controls(newtext).Value = Format(Range(NewText2).Value, "0.00%") :Could not find specified object.
I assume that the syntax is wrong for range(newtext2) but cannot figure out how to phrase correctly.
Any help would be most appreciated
Thanks