habe in userform mehrere textboxen die von der tabelle aus gefüllt werden.
gibt es eine möglichkeit die textboxen anders und kürzer zu füllen als so.
Private Sub UserForm_Initialize()
With Me
.TextBox1.Value = Format(CDbl(ActiveSheet.Range("X1")), "#,##0.00")
If TextBox1.Value = 0 Then
.TextBox1.Value = Format(CDbl(.TextBox1.Text), "#,##0.00")
End If
.TextBox2.Value = Format(CDbl(ActiveSheet.Range("X2")), "#,##0.00")
If TextBox1.Value = 0 Then
.TextBox2.Value = Format(CDbl(.TextBox2.Text), "#,##0.00")
End If
.TextBox3.Value = Format(CDbl(ActiveSheet.Range("X3")), "#,##0.00")
If TextBox1.Value = 0 Then
.TextBox3.Value = Format(CDbl(.TextBox3.Text), "#,##0.00")
End If
.TextBox4.Value = Format(CDbl(ActiveSheet.Range("X4")), "#,##0.00")
If TextBox1.Value = 0 Then
.TextBox4.Value = Format(CDbl(.TextBox4.Text), "#,##0.00")
End If
.TextBox5.Value = Format(CDbl(ActiveSheet.Range("X5")), "#,##0.00")
If TextBox1.Value = 0 Then
.TextBox5.Value = Format(CDbl(.TextBox5.Text), "#,##0.00")
End If
End With
End Sub
es sind noch mehr textboxen als die fünf , ist nur ein ausschnitt
gruß ralle