cplindem
03-03-2014, 12:18 PM
I am trying to rename a series of buttons (shapes) based on a series of cells in another worksheet. I'm trying to use a loop to look at a specific cell for the first button, then one cell over for the next button, and so on. I am currently using "For Each" and "i + 1" to try to do this, but it's not quite working. Either I should use a different type of loop or I have "i + 1" in the wrong spot in my code....I can't figure it out.
Sub ButtonNames()
Dim i As Integer
Dim ButtonText As String
ButtonText = Sheets("Purpose of Call").Range("D36").Offset(0, i)
Dim SummaryButton As Shape
For Each SummaryButton In Sheets("Summaries").Shapes.Range(Array("Button1", "Button2", "Button3"))
i = i + 1
SummaryButton.OLEFormat.Object.Text = ButtonText
Next SummaryButton
End Sub
Any help is greatly appreciated.
Sub ButtonNames()
Dim i As Integer
Dim ButtonText As String
ButtonText = Sheets("Purpose of Call").Range("D36").Offset(0, i)
Dim SummaryButton As Shape
For Each SummaryButton In Sheets("Summaries").Shapes.Range(Array("Button1", "Button2", "Button3"))
i = i + 1
SummaryButton.OLEFormat.Object.Text = ButtonText
Next SummaryButton
End Sub
Any help is greatly appreciated.