Hi all,
I use the following macro to create a series of commandbuttons:
Code
Option Explicit
Dim strButtonname As String
Dim strButtoncaption As String
Dim intI As Integer
Dim intXpositie As Integer
Public Sub click_cmd1()
Call check_groupname
End Sub
Public Sub check_groupname()
intXpositie = 65 'buttons onder elkaar plaatsen
Workbooks("overzicht.xls").Worksheets("Sheet1").Activate
For intI = 1 To 4
Application.ScreenUpdating = False
'plaatsen avn nieuwe button
ActiveSheet.Buttons.Add(30, intXpositie, 100, 30).Select
'macro aanhangen
Selection.OnAction = "Macro3"
'naam geven aan button
strButtonname = Workbooks("meetpunten.xls").Worksheets("Sheet1").Range("A1").Offset(intI, 0).Value
On Error Resume Next
ActiveSheet.Shapes(strButtonname).Select
Selection.Characters.Text = Workbooks("meetpunten.xls").Worksheets("Sheet1").Range("A1").Offset(intI, 1).Value
strButtoncaption = Selection.Characters.Text
intXpositie = intXpositie + 40
Next intI
End Sub
Display More
I want to have a button name (strButtonname) the same as the Selection.Characters.text. But when I select the new button on my sheet excel named the new buttons as “button 2” “button 3”…
What did I do wrong?
Thanks,
Fluppe