View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Option Button with VB code, not working

The enabled property has nothing to do with the value of the button. The
value of the button is either 1 for checked or -4146 for unchecked. You can
toggle the enabled property of the button in code which will enable or
disable the button. If the button is disabled then it can not be selected or
deselected.
--
HTH...

Jim Thomlinson


"Susan" wrote:

try this first & see if it gets past that first line. change the
worksheet name to the proper name.
====================
If Worksheets("Sheet1").OptionButtons("Option Button 2") _
.Enabled = True Then
===================
if you're using a forms optionbutton, it doesn't have a true value, it
has an enabled value.
susan


On Jul 25, 3:04 pm, pgarcia wrote:
Will, it stops at "If OptionButton2.Value = True Then" and it will not
continue from there. This is the full code.

Sub Copy_Paste_AR()
'
Application.ScreenUpdating = False

Sheets("AR").Visible = True

Dim MyPath As String
Dim MyFileName As String

Sheets("AR").Select
Range("H1:H187", Range("H1:H187").End(xlDown)).Copy
Range("H1").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False

Columns("A:G").Delete Shift:=xlToLeft

Sheets("INPUT_A").Select
If OptionButton2 Then
Call AR_GTD
ElseIf OptionButton3 Then
Call AR_Both
ElseIf OptionButton4 Then
Call AR_ECO
End If

Sheets("AR").Select
Range("A1").Select

MyPath = "S:\SUPPORT\CADTAR\CMS\!Exported_Text_Files!\"
MyFileName = "d" & Sheets("INPUT_A").Range("C8").Value & "ar"

ActiveWorkbook.SaveAs Filename:=MyPath & MyFileName, _
FileFormat:=xlText, CreateBackup:=False

Sheets("INPUT_A").Select
MsgBox ("AR file has been created at:" & vbLf &
"S:\SUPPORT\CADTAR\CMS\!Exported_Text_Files!\" )

End Sub