Dear, I am using following code but giving some error.
If cell value A1 is blank option button is hidden
when put any value in A1, it should assign as option button caption
same goes till A7
Sub optionbutton()
'
' optionbutton Macro
'
Private Sub Worksheet_Change(ByVal Target As Range)
Me.OptionButtons("Option Button 1").Visible = Len(Me.Cells(1, 1)) > 0
Me.OptionButtons("Option Button 2").Visible = Len(Me.Cells(2, 1)) > 0
Me.OptionButtons("Option Button 3").Visible = Len(Me.Cells(3, 1)) > 0
Me.OptionButtons("Option Button 4").Visible = Len(Me.Cells(4, 1)) > 0
Me.OptionButtons("Option Button 5").Visible = Len(Me.Cells(5, 1)) > 0
Me.OptionButtons("Option Button 6").Visible = Len(Me.Cells(6, 1)) > 0
Me.OptionButtons("Option Button 7").Visible = Len(Me.Cells(7, 1)) > 0
End Sub
'
ActiveSheet.Shapes.Range(Array("Option Button 1")).Select
Selection.Characters.Text = Range("A1")
ActiveSheet.Shapes.Range(Array("Option Button 2")).Select
Selection.Characters.Text = Range("A2")
ActiveSheet.Shapes.Range(Array("Option Button 3")).Select
Selection.Characters.Text = Range("A3")
ActiveSheet.Shapes.Range(Array("Option Button 4")).Select
Selection.Characters.Text = Range("A4")
ActiveSheet.Shapes.Range(Array("Option Button 5")).Select
Selection.Characters.Text = Range("A5")
ActiveSheet.Shapes.Range(Array("Option Button 6")).Select
Selection.Characters.Text = Range("A6")
ActiveSheet.Shapes.Range(Array("Option Button 7")).Select
Selection.Characters.Text = Range("A7")
End Sub
If cell value A1 is blank option button is hidden
when put any value in A1, it should assign as option button caption
same goes till A7
Sub optionbutton()
'
' optionbutton Macro
'
Private Sub Worksheet_Change(ByVal Target As Range)
Me.OptionButtons("Option Button 1").Visible = Len(Me.Cells(1, 1)) > 0
Me.OptionButtons("Option Button 2").Visible = Len(Me.Cells(2, 1)) > 0
Me.OptionButtons("Option Button 3").Visible = Len(Me.Cells(3, 1)) > 0
Me.OptionButtons("Option Button 4").Visible = Len(Me.Cells(4, 1)) > 0
Me.OptionButtons("Option Button 5").Visible = Len(Me.Cells(5, 1)) > 0
Me.OptionButtons("Option Button 6").Visible = Len(Me.Cells(6, 1)) > 0
Me.OptionButtons("Option Button 7").Visible = Len(Me.Cells(7, 1)) > 0
End Sub
'
ActiveSheet.Shapes.Range(Array("Option Button 1")).Select
Selection.Characters.Text = Range("A1")
ActiveSheet.Shapes.Range(Array("Option Button 2")).Select
Selection.Characters.Text = Range("A2")
ActiveSheet.Shapes.Range(Array("Option Button 3")).Select
Selection.Characters.Text = Range("A3")
ActiveSheet.Shapes.Range(Array("Option Button 4")).Select
Selection.Characters.Text = Range("A4")
ActiveSheet.Shapes.Range(Array("Option Button 5")).Select
Selection.Characters.Text = Range("A5")
ActiveSheet.Shapes.Range(Array("Option Button 6")).Select
Selection.Characters.Text = Range("A6")
ActiveSheet.Shapes.Range(Array("Option Button 7")).Select
Selection.Characters.Text = Range("A7")
End Sub