LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Create a public variable

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" wrote in message
...
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" wrote in message
...
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

.



.


 
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
Public variable (or Public Const?) Brettjg Excel Programming 14 April 23rd 09 11:30 PM
Public variable (or Public Const?) Tim Williams[_2_] Excel Programming 0 April 23rd 09 06:33 AM
Public variable Eric[_35_] Excel Programming 7 March 18th 07 06:54 AM
Public Variable Jason Excel Programming 4 April 12th 04 07:06 PM
public variable marwan hefnawy Excel Programming 1 September 5th 03 08:54 AM


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

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

About Us

"It's about Microsoft Excel"