> If rng(1, 7).Value = "Yes" Then
> Cleared = True
> Else
> Cleared = False
> End If
Or, more concisely, replace the above with this single line of code...
Cleared = rng(1, 7).Value = "Yes"
--
Rick (MVP - Excel)
"Ryan H" <(E-Mail Removed)> wrote in message
news:39D1A15F-B859-4299-AD2B-(E-Mail Removed)...
> No, Bob. I didn't. Thanks for the correction. It should be.
>
> 'in standard module
> Public Cleared As Boolean
>
> If rng(1, 7).Value = "Yes" Then
> Cleared = True
> Else
> Cleared = False
> End If
>
> Sub FinishedButton_Click()
> If Cleared Then Exit Sub
> End Sub
>
> --
> Cheers,
> Ryan
>
>
> "Bob Phillips" wrote:
>
>> Did you actually try that?
>>
>> --
>>
>> HTH
>>
>> Bob Phillips
>>
>> (replace xxxx in the email address with gmail if mailing direct)
>>
>> "Ryan H" <(E-Mail Removed)> wrote in message
>> news:3F6E781B-BE13-4174-986A-(E-Mail Removed)...
>> > This should help. If this helps please click "YES" below.
>> >
>> > If rng(1, 7).Value = "Yes" Then
>> > Public Cleared As Boolean
>> > Cleared = True
>> > End If
>> >
>> > Sub FinishedButton_Click()
>> > If Cleared Then Exit Sub
>> > End Sub
>> > --
>> > Cheers,
>> > Ryan
>> >
>> >
>> > "ordnance1" wrote:
>> >
>> >> Below is my UserForm_Initialize code. What I'm wondering is, is it
>> >> possible
>> >> to declare a Public Variable if rng(1, 7).value is "Yes"?
>> >>
>> >> I would call the Variable Cleared and then during my exit routine
>> >> (clicking the Finished Button) I would need a statement that said if
>> >> Cleared
>> >> is true then exit sub.
>> >>
>> >>
>> >>
>> >> Private Sub UserForm_Initialize()
>> >> Dim rng
>> >> Set rng = Cells(ActiveCell.Row, 1)
>> >>
>> >> TextBox1.Value = rng(1, 1) 'Date
>> >> TextBox1.Text = Format(TextBox1.Text, "mm/dd/yyyy")
>> >> TextBox2.Value = rng(1, 2) 'Check Number
>> >> TextBox3.Value = rng(1, 3) 'Check Amount
>> >> TextBox3.Value = Format(TextBox3.Value, "currency")
>> >> TextBox4.Value = rng(1, 4) 'Paid To
>> >> TextBox5.Value = rng(1, 5) 'Explination
>> >>
>> >> If rng(1, 7).Value = "Yes" Then
>> >> OptionButton1.Value = True
>> >> End If
>> >>
>> >> End Sub
>> >>
>> >> .
>> >>
>>
>>
>> .
>>
|