< návrat zpět

MS Excel


Téma: BackColor On TextBox rss

Zaslal/a 6.4.2011 20:25

nio313Ahoj

Mam mensi prohlemik s formatom textboxu podla zadanej hodnoty. Vse slape ako ma pokial nezmenim podmienku v comboboxe. treba nejak resetovat textbox aby to znovu prebehlo cez makro pls tuje kod :
3
Private Sub TextBox145_Change()
Dim x
x = ComboBox10.Value
If x = DTS Then
End If
If [TextBox145] > 31 Then
[TextBox145].BackColor = vbGreen
End If
If [TextBox145] = 31 Then
[TextBox145].BackColor = vbYellow
End If
If [TextBox145] = 30 Then
[TextBox145].BackColor = vbYellow
End If
If [TextBox145] = 29 Then
[TextBox145].BackColor = vbYellow
End If
If [TextBox145] < 29 Then
[TextBox145].BackColor = vbRed
End If

x = ComboBox10.Value
If x = NTB Then
End If
If [TextBox145] > 59 Then
[TextBox145].BackColor = vbGreen
End If
If [TextBox145] = 59 Then
[TextBox145].BackColor = vbYellow
End If
If [TextBox145] = 58 Then
[TextBox145].BackColor = vbYellow
End If
If [TextBox145] = 57 Then
[TextBox145].BackColor = vbYellow
End If
If [TextBox145] < 57 Then
[TextBox145].BackColor = vbRed
End If

x = ComboBox10.Value
If x = AiO Then
End If
If [TextBox145] > 19 Then
[TextBox145].BackColor = vbGreen
End If
If [TextBox145] = 19 Then
[TextBox145].BackColor = vbYellow
End If
If [TextBox145] = 18 Then
[TextBox145].BackColor = vbYellow
End If
If [TextBox145] = 17 Then
[TextBox145].BackColor = vbYellow
End If
If [TextBox145] < 17 Then
[TextBox145].BackColor = vbRed
End If

End Sub

Zaslat odpověď >

icon #004605
Poki
asi by to chtelo blize vysvetlit, ceho chcete dosahnout a jaky mate presne problem (kdyz k nemu dochazi) a nejlepsi bude navic prilozit soubor.
Nechce se mi studovat kod a odvozovat si z nej pozadi problemu...citovat
#004665
nio313
Ahoj k niecomu som sa prepracoval ale pri zadani jednej podmienky to neformatuje. Neviem kde mam chybu v makre.
6
Příloha: rar4665_farba.rar (13kB, staženo 18x)
citovat
#004670
avatar
D nefunguje, jelikož

Private Sub TextBox2_Change()
Dim X
X = Cells(1, 2).Value
If X = "D" Then
If TextBox2 >= 32 Then
[TextBox2].BackColor = vbGreen
End If
If TextBox2 = 31 Then
[TextBox2].BackColor = vbYellow
End If
If TextBox2 = 30 Then
[TextBox2].BackColor = vbYellow
End If
If TextBox2 = 29 Then
[TextBox2].BackColor = vbYellow
End If
If TextBox2 = 28 Then
[TextBox2].BackColor = vbYellow
End If
If TextBox2 < 28 Then
[TextBox2].BackColor = vbRed
End If
Else
[TextBox2].BackColor = vbWhite
End If
If X = "N" Then
If TextBox2 >= 60 Then
[TextBox2].BackColor = vbGreen
End If
If TextBox2 = 59 Then
[TextBox2].BackColor = vbYellow
End If
If TextBox2 = 58 Then
[TextBox2].BackColor = vbYellow
End If
If TextBox2 = 57 Then
[TextBox2].BackColor = vbYellow
End If
If TextBox2 < 57 Then
[TextBox2].BackColor = vbRed
End If
Else
[TextBox2].BackColor = vbWhite
End If

If X = "A" Then
If TextBox2 >= 20 Then
[TextBox2].BackColor = vbGreen
End If
If TextBox2 = 19 Then
[TextBox2].BackColor = vbYellow
End If
If TextBox2 = 18 Then
[TextBox2].BackColor = vbYellow
End If
If TextBox2 = 17 Then
[TextBox2].BackColor = vbYellow
End If
If TextBox2 < 17 Then
[TextBox2].BackColor = vbRed
End If
End If
End Sub

Else u "N" ji udělá vždy bezbarvou.citovat
#004675
nio313
Dik uz to jede 4citovat

Uživatelské menu

Nejste přihlášen(a)
avatar\n

Menu

On-line nástroje

Formulář Faktura

Formulář Faktura IV

Oblíbený formulář Faktura byl vylepšen a rozšířen.
Více se dočtete zde.

Aktivní diskuse