-
Solved: writing option button caption in a cell
Hi guys
I wanna loop through all my optionbuttons to find which one is set to true and then write it's Caption in a cell. The line " ActiveCell.text = optbut.Caption" is wrong but i don't know why. Any ideas ?
[vba]Dim optbut As Object
For Each optbut In Me.Controls
If TypeName(optbut) = "OptionButton" Then
If optbut.Object.GroupName = "centre" Then
If optbut.Value = True Then
ActiveCell.text = optbut.Caption
End If
End If
End If
Next optbut[/vba]
-
Try
[VBA]
ActiveCell = optbut.Caption
[/VBA]
Regards
MD
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
-
-
Ok it works fine
thanks MD
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules