23.01.2018, 13:35
heje excelfreunde
habe eine bitte an euch, wie ändere ich den nachfolgenden code in einen schnelleren, kürzeren und effizenteren code...
habe eine bitte an euch, wie ändere ich den nachfolgenden code in einen schnelleren, kürzeren und effizenteren code...
Code:
Public Sub BearbeiteEingabeDaten(ByVal strTB As String) 'TB.value = strTB gleich ""
Dim TB As Object
On Error GoTo Fehler
For Each TB In UserForm1.frmFang1.Controls
If TypeName(TB) = "TextBox" Then TB.Value = strTB
Next TB
For Each TB In UserForm1.frmFang2.Controls
If TypeName(TB) = "TextBox" Then TB.Value = strTB
Next TB
For Each TB In UserForm1.frmFang3.Controls
If TypeName(TB) = "TextBox" Then TB.Value = strTB
Next TB
For Each TB In UserForm1.frmFang4.Controls
If TypeName(TB) = "TextBox" Then TB.Value = strTB
Next TB
For Each TB In UserForm1.frmFang5.Controls
If TypeName(TB) = "TextBox" Then TB.Value = strTB
Next TB
For Each TB In UserForm1.frmFang6.Controls
If TypeName(TB) = "TextBox" Then TB.Value = strTB
Next TB
For Each TB In UserForm1.frmFang7.Controls
If TypeName(TB) = "TextBox" Then TB.Value = strTB
Next TB
For Each TB In UserForm1.frmFang9.Controls
If TypeName(TB) = "TextBox" Then TB.Value = strTB
Next TB
For Each TB In UserForm1.frmFang10.Controls
If TypeName(TB) = "TextBox" Then TB.Value = strTB
Next TB
For Each TB In UserForm1.frmFang11.Controls
If TypeName(TB) = "TextBox" Then TB.Value = strTB
Next TB
For Each TB In UserForm1.frmFang12.Controls
If TypeName(TB) = "TextBox" Then TB.Value = strTB
Next TB
For Each TB In UserForm1.frmFang13.Controls
If TypeName(TB) = "TextBox" Then TB.Value = strTB
Next TB
For Each TB In UserForm1.frmFang14.Controls
If TypeName(TB) = "TextBox" Then TB.Value = strTB
Next TB
For Each TB In UserForm1.frmFang15.Controls
If TypeName(TB) = "TextBox" Then TB.Value = strTB
Next TB
UserForm1.frmFang8.TextBox212.Value = strTB
UserForm1.frmFang8.TextBox214.Value = strTB
UserForm1.frmFang8.TextBox216.Value = strTB
UserForm1.frmFang8.TextBox218.Value = strTB
UserForm1.frmFang8.TextBox220.Value = strTB
UserForm1.frmFang8.TextBox222.Value = strTB
UserForm1.frmFang8.TextBox224.Value = strTB
UserForm1.frmFang8.TextBox226.Value = strTB
UserForm1.frmFang8.TextBox228.Value = strTB
UserForm1.frmFang8.TextBox230.Value = strTB
UserForm1.frmFang8.TextBox232.Value = strTB
UserForm1.frmFang8.TextBox234.Value = strTB
On Error GoTo 0
Exit Sub
Fehler:
If Err.Number > 0 Then
MsgBox "CLS_01_01 Fehlercode : " + CStr(Err.Number) + " " + Err.Description + " " + CStr(Err.Source)
End If
End Sub
Vielen Dank
--Janosch
Excel 2019 (64bit) Win 10 Pro (64bit)
--Janosch
Excel 2019 (64bit) Win 10 Pro (64bit)