LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Conditional BackColor Loop

This did it... thanks for your help...FYI...I prohibited entries with a
variance of 10 through the textbox exit function.. everything
works perfect (so far anyway)

Private Sub ChkEditValues(Variance As Long)


Dim Answer, SampleVal, StandardVal As Long
Dim TextBoxes(5) As String
Dim MyMsg As String
Dim ErrFlag As Boolean


StandardVal = Val(Me.Controls("Standard").Text)

For Ctr = 1 To 5
TextBoxes(Ctr) = Me.Controls("Sample" & CStr(Ctr)).Name
Next


ErrFlag = False
For Ctr = 1 To 5
Set MyTB = Me.Controls(TextBoxes(Ctr))
SampleVal = Val(MyTB.Text)
If SampleVal <= StandardVal - 3 Then MyTB.BackColor = &HFFFF&
If SampleVal = StandardVal + 3 Then MyTB.BackColor = &HFFFF&
If MyTB.BackColor = &HFFFF& Then
ErrFlag = True
End If
Next
If ErrFlag Then
MyMsg = "Please check the highlighted entries. "
MyMsg = MyMsg & "Click YES if OK."
Answer = MsgBox(MyMsg, vbYesNo, "Double Check")
If Answer = vbYes Then
For Ctr = 1 To 5
Set MyTB = Me.Controls(TextBoxes(Ctr))
MyTB.BackColor = &H80000005
Next
Else
ErrFlag = False
Exit Sub
End If
End If
PutData
MsgBox "Edits have been entered"


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
multiselect listbox backcolor Russ Excel Programming 5 September 1st 05 11:39 PM
Change BackColor Steve Excel Programming 1 July 11th 05 04:09 PM
TextBox BackColor Lenny_821[_11_] Excel Programming 6 June 15th 05 06:13 PM
Changing backcolor of commandbutton scottnshelly[_21_] Excel Programming 2 April 22nd 04 11:27 PM
BackColor property code Joe Mathis Excel Programming 3 December 9th 03 04:11 PM


All times are GMT +1. The time now is 05:12 PM.

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"