title image


Smiley Re: in Userform: soll durch checkbox: eine Berechnung in Tabelle1 erfolgen.
Hallo amo,



ich hab mich mal versucht. Makrocode ist nicht schön, dafür aber selten :)



Das Ergebnis siehst du als Bildchen in der Anlage.





Private Sub UserForm_Initialize()

TextBox1.Enabled = False

TextBox2.Enabled = False

TextBox3.Enabled = False

TextBox4.Enabled = False

TextBox1.Text = 0

TextBox2.Text = 0

TextBox3.Text = 0

TextBox4.Text = 0



Image1.Visible = False

Image2.Visible = False

Image3.Visible = False

Image4.Visible = False

Image5.Visible = True



SpinButton1.Enabled = False

SpinButton2.Enabled = False

SpinButton3.Enabled = False

SpinButton4.Enabled = False



SpinButton1.Min = 0

SpinButton1.Max = 100

SpinButton1.Value = 0

SpinButton2.Min = 0

SpinButton2.Max = 100

SpinButton2.Value = 0

SpinButton3.Min = 0

SpinButton3.Max = 100

SpinButton3.Value = 0

SpinButton4.Min = 0

SpinButton4.Max = 100

SpinButton4.Value = 0

End Sub



Private Sub CheckBox2_Click()

If CheckBox2 = True Then

TextBox1.Enabled = True

SpinButton1.Enabled = True

Image1.Visible = True

Image2.Visible = False

Image3.Visible = False

Image4.Visible = False

Image5.Visible = False

Else

TextBox1.Text = 0

TextBox1.Enabled = False

SpinButton1.Enabled = False

Image1.Visible = False

Image2.Visible = False

Image3.Visible = False

Image4.Visible = False

Image5.Visible = True



End If

End Sub



Private Sub CheckBox3_Click()

If CheckBox3 = True Then

TextBox2.Enabled = True

SpinButton2.Enabled = True

Image1.Visible = False

Image2.Visible = True

Image3.Visible = False

Image4.Visible = False

Image5.Visible = False

Else

TextBox2.Text = 0

TextBox2.Enabled = False

SpinButton2.Enabled = False

Image1.Visible = False

Image2.Visible = False

Image3.Visible = False

Image4.Visible = False

Image5.Visible = True

End If

End Sub

Private Sub CheckBox4_Click()

If CheckBox4 = True Then

TextBox3.Enabled = True

SpinButton3.Enabled = True

Image1.Visible = False

Image2.Visible = False

Image3.Visible = True

Image4.Visible = False

Image5.Visible = False

Else

TextBox3.Text = 0

TextBox3.Enabled = False

SpinButton3.Enabled = False

Image1.Visible = False

Image2.Visible = False

Image3.Visible = False

Image4.Visible = False

Image5.Visible = True

End If

End Sub

Private Sub CheckBox5_Click()

If CheckBox5 = True Then

TextBox4.Enabled = True

SpinButton4.Enabled = True

Image1.Visible = False

Image2.Visible = False

Image3.Visible = False

Image4.Visible = True

Image5.Visible = False

Else

TextBox4.Text = 0

TextBox4.Enabled = False

SpinButton4.Enabled = False

Image1.Visible = False

Image2.Visible = False

Image3.Visible = False

Image4.Visible = False

Image5.Visible = True

End If

End Sub



Private Sub CommandButton1_Click()

Dim Wert1 As Long

Dim Wert2 As Long

Dim Wert3 As Long

Dim Wert4 As Long



UserForm1.Hide



Wert1 = CLng(TextBox1)

If Wert1 = 0 Then

Wert1 = 1

End If



Wert2 = CLng(TextBox2)

If Wert2 = 0 Then

Wert2 = 1

End If



Wert3 = CLng(TextBox3)

If Wert3 = 0 Then

Wert3 = 1

End If



Wert4 = CLng(TextBox4)

If Wert4 = 0 Then

Wert4 = 1

End If

[A1] = [B1] * Wert1 * Wert2 * Wert3 * Wert4

End Sub



Private Sub SpinButton1_Change()

TextBox1.Text = SpinButton1.Value

End Sub

Private Sub SpinButton2_Change()

TextBox2.Text = SpinButton2.Value

End Sub

Private Sub SpinButton3_Change()

TextBox3.Text = SpinButton3.Value

End Sub

Private Sub SpinButton4_Change()

TextBox4.Text = SpinButton4.Value

End Sub







Viele Grüße

Herby





geschrieben von

Anhang
Bild 11224 zu Artikel 532810

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: