RE:Option Butts

Carlos Rivera

New Member
Joined
Aug 16, 2007
Messages
45
RE:Option Butts

John hello!!, Are you there? I'm sending the codes about the option buttons, I made them to work!! here is the code, what opinion does it deserve?

Code:

Private Sub CommandButton1_Click()

End Sub

Private Sub cmdCancelar_Click()
Dim Resp As Integer
Resp = MsgBox("Seguro que desea cancelar?", vbQuestion + vbYesNo, "Cancelar")
If Resp = vbYes Then
Unload Me
End If
End Sub

Private Sub cmdGuardar_Click()
If Val(txtNumeroAngulo.Text) < 0 Or Val(txtNumeroAngulo.Text) > 180 Then
MsgBox "Numero Angulo No Valido"
txtNumeroAngulo.SetFocus
Exit Sub
End If
Worksheets("Sheet1").Activate
Range("C28").Select

If Range("C28").Value = "" Then
Range("C28").Activate

Else
Worksheets("Sheet1").Activate
Range("G28").Select

If Range("G28").Value = "" Then
Range("G28").Activate
End If
End If
With ActiveCell
.Value = txtNumeroAngulo.Text
End With

With ActiveCell
.BorderAround Weight:=xlThin, ColorIndex:=1
End With

With ActiveCell.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With

'Set cell 4 columns right of activecell to blank, no border, no color
If Range("C28") Then
With ActiveCell.Offset(, 4)
.Value = ""
.Borders.LineStyle = xlNone
.Interior.ColorIndex = xlNone
End With
End If

'Set cell 4 columns left of activecell to blank, no border, no color
If Range("G28") Then
With ActiveCell.Offset(, -4)
.Value = ""
.Borders.LineStyle = xlNone
.Interior.ColorIndex = xlNone
End With
End If
Unload Me
End Sub

Private Sub UserForm_Click()

End Sub
_____________________________
Carlos
 

Some videos you may like

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Datsmart

Well-known Member
Joined
Jun 19, 2003
Messages
7,985
Glad you got it to work for you.

I misunderstood your request. I thought you wanted to change the button colors, not the cell themselves.

Anyway, good work.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,305
Messages
5,600,867
Members
414,410
Latest member
4610

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top