ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change 'Caption' on ToggleButtons with VBA (https://www.excelbanter.com/excel-programming/386300-re-change-caption-togglebuttons-vba.html)

Greg Wilson

Change 'Caption' on ToggleButtons with VBA
 
Try:

Sub addToggles()
Dim i As Integer
For i = 0 To 1
With ActiveSheet.OLEObjects.Add("Forms.ToggleButton.1", _
Left:=1 + i * 73, Top:=243, Width:=72, Height:=30.75)
.Object.Caption = IIf(i = 0, "Start Date", "End Date")
End With
Next
End Sub

Regards,
Greg





All times are GMT +1. The time now is 10:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com