Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default VBA Script for Radio Button

My active sheet has 2 buttons labeled "High" and "Low". Selection of one deselects the other. Can someone please suggest a VBA script that would be equivalent to clicking on one of the buttons?

Many thanks for all help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default VBA Script for Radio Button

Hi,

Am Wed, 27 Jan 2021 06:50:07 -0800 (PST) schrieb programmernovice:

My active sheet has 2 buttons labeled "High" and "Low". Selection of one deselects the other. Can someone please suggest a VBA script that would be equivalent to clicking on one of the buttons?


try:

Private Sub CommandButton1_Click()
With CommandButton1
If .Caption = "High" Then
'do the stuff you want for button "High"
.Caption = "Low"
Else
'do the stuff you want for button "Low"
.Caption = "High"
End If
End With
End Sub


Regards
Claus B.
--
Windows10
Office 2016
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default VBA Script for Radio Button

On Wednesday, January 27, 2021 at 10:41:36 AM UTC-6, Claus Busch wrote:
Hi,
Am Wed, 27 Jan 2021 06:50:07 -0800 (PST) schrieb programmernovice:

My active sheet has 2 buttons labeled "High" and "Low". Selection of one deselects the other. Can someone please suggest a VBA script that would be equivalent to clicking on one of the buttons?

try:

Private Sub CommandButton1_Click()
With CommandButton1
If .Caption = "High" Then
'do the stuff you want for button "High"
.Caption = "Low"
Else
'do the stuff you want for button "Low"
.Caption = "High"
End If
End With
End Sub


Regards
Claus B.
--
Windows10
Office 2016

Greatly appreciate your help, Claus!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default VBA Script for Radio Button

On Wednesday, January 27, 2021 at 10:41:36 AM UTC-6, Claus Busch wrote:
Hi,
Am Wed, 27 Jan 2021 06:50:07 -0800 (PST) schrieb programmernovice:

My active sheet has 2 buttons labeled "High" and "Low". Selection of one deselects the other. Can someone please suggest a VBA script that would be equivalent to clicking on one of the buttons?

try:

Private Sub CommandButton1_Click()
With CommandButton1
If .Caption = "High" Then
'do the stuff you want for button "High"
.Caption = "Low"
Else
'do the stuff you want for button "Low"
.Caption = "High"
End If
End With
End Sub



Hello again Claus. It appears that the labels "high" and "low" are perhaps not the appropriate names for the radio buttons as needed by the script. I get

Run-time error '424'
Object required

Any suggestions? Thanks again for your guidance.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
radio button help sam Excel Programming 3 July 6th 09 08:12 PM
radio button help tjb Excel Worksheet Functions 1 September 27th 05 01:16 AM
"RADIO BUTTON" Ian Shere Excel Discussion (Misc queries) 1 July 4th 05 10:59 PM
How do I lock a radio button group if a N/A button is selected worry a lot Excel Discussion (Misc queries) 2 May 21st 05 08:33 PM
VBA: Disable Frame and Radio Buttons based on Another Radio Button Being True Mcasteel Excel Worksheet Functions 2 October 29th 04 07:06 PM


All times are GMT +1. The time now is 03:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"