L
LEU
I have the following macro that wont fill in my form with the existing data
when I open it.
Private Sub UserForm_Initialize()
Dim myType1, myType2, myType3, myType4, myType5, _
myType6, myType7, myType8, myType9, myType10, _
myType11, myType12, myType13, myType14
myType1 = Split(" |D|N", "|")
With ComboBox1
.List = myType1
.ListIndex = 0
.MatchRequired = True
End With
myType2 = Split(" |D|N", "|")
With ComboBox2
.List = myType2
.ListIndex = 0
.MatchRequired = True
End With
myType3 = Split(" |D|N", "|")
With ComboBox3
.List = myType3
.ListIndex = 0
.MatchRequired = True
End With
myType4 = Split(" |D|N", "|")
With ComboBox4
.List = myType4
.ListIndex = 0
.MatchRequired = True
End With
myType5 = Split(" |D|N", "|")
With ComboBox5
.List = myType5
.ListIndex = 0
.MatchRequired = True
End With
myType6 = Split(" |D|N", "|")
With ComboBox6
.List = myType6
.ListIndex = 0
.MatchRequired = True
End With
myType7 = Split(" |D|N", "|")
With ComboBox7
.List = myType7
.ListIndex = 0
.MatchRequired = True
End With
myType8 = Split(" |D|N", "|")
With ComboBox8
.List = myType8
.ListIndex = 0
.MatchRequired = True
End With
myType9 = Split(" |D|N", "|")
With ComboBox9
.List = myType9
.ListIndex = 0
.MatchRequired = True
End With
myType10 = Split(" |D|N", "|")
With ComboBox10
.List = myType10
.ListIndex = 0
.MatchRequired = True
End With
myType11 = Split(" |D|N", "|")
With ComboBox11
.List = myType11
.ListIndex = 0
.MatchRequired = True
End With
myType12 = Split(" |D|N", "|")
With ComboBox12
.List = myType12
.ListIndex = 0
.MatchRequired = True
End With
myType13 = Split(" |D|N", "|")
With ComboBox13
.List = myType13
.ListIndex = 0
.MatchRequired = True
End With
myType14 = Split(" |D|N", "|")
With ComboBox14
.List = myType14
.ListIndex = 0
.MatchRequired = True
End With
On Error Resume Next
Dim oBMs As Bookmarks
TextBox1.Value = oBMs("bkHWS1").Range.Text
TextBox2.Value = oBMs("bkHWS2").Range.Text
TextBox3.Value = oBMs("bkHWS3").Range.Text
TextBox4.Value = oBMs("bkHWS4").Range.Text
TextBox5.Value = oBMs("bkHWS5").Range.Text
TextBox6.Value = oBMs("bkHWS").Range.Text
TextBox7.Value = oBMs("bkHWS7").Range.Text
TextBox8.Value = oBMs("bkHWS8").Range.Text
TextBox9.Value = oBMs("bkHWS9").Range.Text
TextBox10.Value = oBMs("bkHWS10").Range.Text
TextBox11.Value = oBMs("bkHWS11").Range.Text
TextBox12.Value = oBMs("bkHWS12").Range.Text
TextBox13.Value = oBMs("bkHWS13").Range.Text
TextBox14.Value = oBMs("bkHWS14").Range.Text
ComboBox1.Value = oBMs("ShiftDay1").Range.Text
ComboBox2.Value = oBMs("ShiftDay2").Range.Text
ComboBox3.Value = oBMs("ShiftDay3").Range.Text
ComboBox4.Value = oBMs("ShiftDay4").Range.Text
ComboBox5.Value = oBMs("ShiftDay5").Range.Text
ComboBox6.Value = oBMs("ShiftDay6").Range.Text
ComboBox7.Value = oBMs("ShiftDay7").Range.Text
ComboBox8.Value = oBMs("ShiftDay8").Range.Text
ComboBox9.Value = oBMs("ShiftDay9").Range.Text
ComboBox10.Value = oBMs("ShiftDay10").Range.Text
ComboBox11.Value = oBMs("ShiftDay11").Range.Text
ComboBox12.Value = oBMs("ShiftDay12").Range.Text
ComboBox13.Value = oBMs("ShiftDay13").Range.Text
ComboBox14.Value = oBMs("ShiftDay14").Range.Text
End Sub
when I open it.
Private Sub UserForm_Initialize()
Dim myType1, myType2, myType3, myType4, myType5, _
myType6, myType7, myType8, myType9, myType10, _
myType11, myType12, myType13, myType14
myType1 = Split(" |D|N", "|")
With ComboBox1
.List = myType1
.ListIndex = 0
.MatchRequired = True
End With
myType2 = Split(" |D|N", "|")
With ComboBox2
.List = myType2
.ListIndex = 0
.MatchRequired = True
End With
myType3 = Split(" |D|N", "|")
With ComboBox3
.List = myType3
.ListIndex = 0
.MatchRequired = True
End With
myType4 = Split(" |D|N", "|")
With ComboBox4
.List = myType4
.ListIndex = 0
.MatchRequired = True
End With
myType5 = Split(" |D|N", "|")
With ComboBox5
.List = myType5
.ListIndex = 0
.MatchRequired = True
End With
myType6 = Split(" |D|N", "|")
With ComboBox6
.List = myType6
.ListIndex = 0
.MatchRequired = True
End With
myType7 = Split(" |D|N", "|")
With ComboBox7
.List = myType7
.ListIndex = 0
.MatchRequired = True
End With
myType8 = Split(" |D|N", "|")
With ComboBox8
.List = myType8
.ListIndex = 0
.MatchRequired = True
End With
myType9 = Split(" |D|N", "|")
With ComboBox9
.List = myType9
.ListIndex = 0
.MatchRequired = True
End With
myType10 = Split(" |D|N", "|")
With ComboBox10
.List = myType10
.ListIndex = 0
.MatchRequired = True
End With
myType11 = Split(" |D|N", "|")
With ComboBox11
.List = myType11
.ListIndex = 0
.MatchRequired = True
End With
myType12 = Split(" |D|N", "|")
With ComboBox12
.List = myType12
.ListIndex = 0
.MatchRequired = True
End With
myType13 = Split(" |D|N", "|")
With ComboBox13
.List = myType13
.ListIndex = 0
.MatchRequired = True
End With
myType14 = Split(" |D|N", "|")
With ComboBox14
.List = myType14
.ListIndex = 0
.MatchRequired = True
End With
On Error Resume Next
Dim oBMs As Bookmarks
TextBox1.Value = oBMs("bkHWS1").Range.Text
TextBox2.Value = oBMs("bkHWS2").Range.Text
TextBox3.Value = oBMs("bkHWS3").Range.Text
TextBox4.Value = oBMs("bkHWS4").Range.Text
TextBox5.Value = oBMs("bkHWS5").Range.Text
TextBox6.Value = oBMs("bkHWS").Range.Text
TextBox7.Value = oBMs("bkHWS7").Range.Text
TextBox8.Value = oBMs("bkHWS8").Range.Text
TextBox9.Value = oBMs("bkHWS9").Range.Text
TextBox10.Value = oBMs("bkHWS10").Range.Text
TextBox11.Value = oBMs("bkHWS11").Range.Text
TextBox12.Value = oBMs("bkHWS12").Range.Text
TextBox13.Value = oBMs("bkHWS13").Range.Text
TextBox14.Value = oBMs("bkHWS14").Range.Text
ComboBox1.Value = oBMs("ShiftDay1").Range.Text
ComboBox2.Value = oBMs("ShiftDay2").Range.Text
ComboBox3.Value = oBMs("ShiftDay3").Range.Text
ComboBox4.Value = oBMs("ShiftDay4").Range.Text
ComboBox5.Value = oBMs("ShiftDay5").Range.Text
ComboBox6.Value = oBMs("ShiftDay6").Range.Text
ComboBox7.Value = oBMs("ShiftDay7").Range.Text
ComboBox8.Value = oBMs("ShiftDay8").Range.Text
ComboBox9.Value = oBMs("ShiftDay9").Range.Text
ComboBox10.Value = oBMs("ShiftDay10").Range.Text
ComboBox11.Value = oBMs("ShiftDay11").Range.Text
ComboBox12.Value = oBMs("ShiftDay12").Range.Text
ComboBox13.Value = oBMs("ShiftDay13").Range.Text
ComboBox14.Value = oBMs("ShiftDay14").Range.Text
End Sub