I'm at a loss as to why my text/numbers are coming out out-of-order. I'm sure it's something simple that will seem obvious once pointed out. I've included the whole Sub for review of the error, since I'm fairly new to macro programming and it could be just about anything.
Basically, on my UserForm I need things to look like this:
And so on. I've already made sure my various Labels are in the proper order and positioned correctly, so I know it's not that. However, when run the UserForm looks like this:
It shifts the captions for those labels one row down on the right side.
And, yes, I know my code is probably messy or overly complicated. I can only say I'm sorry.
Basically, on my UserForm I need things to look like this:
Code:
Text1...........Text2
Text3...........Text4
....Text5.......Text6
Text7...........Text8
....Text9......Text10
Text11.........Text12
....Text13.....Text14
And so on. I've already made sure my various Labels are in the proper order and positioned correctly, so I know it's not that. However, when run the UserForm looks like this:
Code:
Text1...........Text2
Text3...........Text4
....Text5.......Text6
Text7...........Text8
....Text9.......
Text11.........Text10
....Text13.....Text12
It shifts the captions for those labels one row down on the right side.
And, yes, I know my code is probably messy or overly complicated. I can only say I'm sorry.
Code:
Private Sub SkillLabels()
Dim Srow01 As String
Dim Srow02 As String
Dim Srow03 As String
Dim Srow04 As String
Dim Srow05 As String
Dim Srow06 As String
Dim Srow07 As String
Dim Srow08 As String
Dim Srow09 As String
Dim Srow10 As String
Dim Srow11 As String
Dim Srow12 As String
Dim Srow13 As String
Dim Srow14 As String
Dim Srow15 As String
Dim Srow16 As String
Dim Srow17 As String
Dim Srow18 As String
Dim Srow19 As String
Dim Srow20 As String
Dim Srow21 As String
Dim Srow22 As String
Dim Srow23 As String
Dim Srow24 As String
Dim Srow25 As String
Dim Rv01 As String
Dim Rv02 As String
Dim Rv03 As String
Dim Rv04 As String
Dim Rv05 As String
Dim Rv06 As String
Dim Rv07 As String
Dim Rv08 As String
Dim Rv09 As String
Dim Rv10 As String
Dim Rv11 As String
Dim Rv12 As String
Dim Rv13 As String
Dim Rv14 As String
Dim Rv15 As String
Dim Rv16 As String
Dim Rv17 As String
Dim Rv18 As String
Dim Rv19 As String
Dim Rv20 As String
Dim Rv21 As String
Dim Rv22 As String
Dim Rv23 As String
Dim Rv24 As String
Dim Rv25 As String
Dim Row As Integer
Row = TPListBox.ListIndex + 4
Rv01 = Sheets("TPs").Cells(Row, 45)
Rv02 = Sheets("TPs").Cells(Row, 47)
Rv03 = Sheets("TPs").Cells(Row, 49)
Rv05 = Sheets("TPs").Cells(Row, 51)
Rv06 = Sheets("TPs").Cells(Row, 53)
Rv07 = Sheets("TPs").Cells(Row, 55)
Rv08 = Sheets("TPs").Cells(Row, 57)
Rv09 = Sheets("TPs").Cells(Row, 59)
Rv10 = Sheets("TPs").Cells(Row, 61)
Rv11 = Sheets("TPs").Cells(Row, 63)
Rv12 = Sheets("TPs").Cells(Row, 65)
Rv13 = Sheets("TPs").Cells(Row, 67)
Rv14 = Sheets("TPs").Cells(Row, 69)
Rv15 = Sheets("TPs").Cells(Row, 71)
Rv16 = Sheets("TPs").Cells(Row, 73)
Rv17 = Sheets("TPs").Cells(Row, 75)
Rv18 = Sheets("TPs").Cells(Row, 77)
Rv19 = Sheets("TPs").Cells(Row, 79)
Rv20 = Sheets("TPs").Cells(Row, 81)
Rv21 = Sheets("TPs").Cells(Row, 83)
Rv22 = Sheets("TPs").Cells(Row, 85)
Rv23 = Sheets("TPs").Cells(Row, 87)
Rv24 = Sheets("TPs").Cells(Row, 89)
Rv25 = Sheets("TPs").Cells(Row, 91)
If Sheets("TPs").Cells(2, 5) = " " Then
Srow01 = Sheets("TPs").Range("AJ23").Value
Srow02 = Sheets("TPs").Range("AJ24").Value
Srow03 = Sheets("TPs").Range("AJ25").Value
Srow04 = Sheets("TPs").Range("AJ26").Value
Srow05 = Sheets("TPs").Range("AJ27").Value
Srow06 = Sheets("TPs").Range("AJ28").Value
Srow07 = Sheets("TPs").Range("AJ29").Value
Srow08 = Sheets("TPs").Range("AJ30").Value
Srow09 = Sheets("TPs").Range("AJ31").Value
Srow10 = Sheets("TPs").Range("AJ32").Value
Srow11 = Sheets("TPs").Range("AJ33").Value
Srow12 = Sheets("TPs").Range("AJ34").Value
Srow13 = Sheets("TPs").Range("AJ35").Value
Srow14 = Sheets("TPs").Range("AJ36").Value
Srow15 = Sheets("TPs").Range("AJ37").Value
Srow16 = Sheets("TPs").Range("AJ38").Value
Srow17 = Sheets("TPs").Range("AJ39").Value
Srow18 = Sheets("TPs").Range("AJ40").Value
Srow19 = Sheets("TPs").Range("AJ41").Value
Srow20 = Sheets("TPs").Range("AJ42").Value
Srow21 = Sheets("TPs").Range("AJ43").Value
Srow22 = Sheets("TPs").Range("AJ44").Value
Srow23 = Sheets("TPs").Range("AJ45").Value
Srow24 = Sheets("TPs").Range("AJ46").Value
Srow25 = Sheets("TPs").Range("AJ47").Value
ElseIf Sheets("TPs").Cells(2, 17) = " " Then
Srow01 = Sheets("TPs").Range("AJ49").Value
Srow02 = Sheets("TPs").Range("AJ50").Value
Srow03 = Sheets("TPs").Range("AJ51").Value
Srow04 = Sheets("TPs").Range("AJ52").Value
Srow05 = Sheets("TPs").Range("AJ53").Value
Srow06 = Sheets("TPs").Range("AJ54").Value
Srow07 = Sheets("TPs").Range("AJ55").Value
Srow08 = Sheets("TPs").Range("AJ56").Value
Srow09 = Sheets("TPs").Range("AJ57").Value
Srow10 = Sheets("TPs").Range("AJ58").Value
Srow11 = Sheets("TPs").Range("AJ59").Value
Srow12 = Sheets("TPs").Range("AJ60").Value
Srow13 = Sheets("TPs").Range("AJ61").Value
Srow14 = Sheets("TPs").Range("AJ62").Value
Srow15 = Sheets("TPs").Range("AJ63").Value
Srow16 = Sheets("TPs").Range("AJ64").Value
Srow17 = Sheets("TPs").Range("AJ65").Value
Srow18 = Sheets("TPs").Range("AJ66").Value
Srow19 = Sheets("TPs").Range("AJ67").Value
Srow20 = Sheets("TPs").Range("AJ68").Value
Srow21 = Sheets("TPs").Range("AJ69").Value
Srow22 = Sheets("TPs").Range("AJ70").Value
Srow23 = Sheets("TPs").Range("AJ71").Value
Srow24 = Sheets("TPs").Range("AJ72").Value
Srow25 = Sheets("TPs").Range("AJ73").Value
ElseIf Sheets("TPs").Cells(37, 5) = " " Then
Srow01 = Sheets("TPs").Range("AJ75").Value
Srow02 = Sheets("TPs").Range("AJ76").Value
Srow03 = Sheets("TPs").Range("AJ77").Value
Srow04 = Sheets("TPs").Range("AJ78").Value
Srow05 = Sheets("TPs").Range("AJ79").Value
Srow06 = Sheets("TPs").Range("AJ80").Value
Srow07 = Sheets("TPs").Range("AJ81").Value
Srow08 = Sheets("TPs").Range("AJ82").Value
Srow09 = Sheets("TPs").Range("AJ83").Value
Srow10 = Sheets("TPs").Range("AJ84").Value
Srow11 = Sheets("TPs").Range("AJ85").Value
Srow12 = Sheets("TPs").Range("AJ86").Value
Srow13 = Sheets("TPs").Range("AJ87").Value
Srow14 = Sheets("TPs").Range("AJ88").Value
Srow15 = Sheets("TPs").Range("AJ89").Value
Srow16 = Sheets("TPs").Range("AJ90").Value
Srow17 = Sheets("TPs").Range("AJ91").Value
Srow18 = Sheets("TPs").Range("AJ92").Value
Srow19 = Sheets("TPs").Range("AJ93").Value
Srow20 = Sheets("TPs").Range("AJ94").Value
Srow21 = Sheets("TPs").Range("AJ95").Value
Srow22 = Sheets("TPs").Range("AJ96").Value
Srow23 = Sheets("TPs").Range("AJ97").Value
Srow24 = Sheets("TPs").Range("AJ98").Value
Srow25 = Sheets("TPs").Range("AJ99").Value
Else: MsgBox "You can not gain more than three Training Packages at once."
End If
SkillLabel1.Caption = Srow01
RankLabel1.Caption = Rv01
SkillLabel2.Caption = Srow02
RankLabel2.Caption = Rv02
SkillLabel3.Caption = Srow03
RankLabel3.Caption = Rv03
SkillLabel4.Caption = Srow04
RankLabel4.Caption = Rv04
SkillLabel5.Caption = Srow05
RankLabel5.Caption = Rv05
SkillLabel6.Caption = Srow06
RankLabel6.Caption = Rv06
SkillLabel7.Caption = Srow07
RankLabel7.Caption = Rv07
SkillLabel8.Caption = Srow08
RankLabel8.Caption = Rv08
SkillLabel9.Caption = Srow09
RankLabel9.Caption = Rv09
SkillLabel10.Caption = Srow10
RankLabel10.Caption = Rv10
SkillLabel11.Caption = Srow11
RankLabel11.Caption = Rv11
SkillLabel12.Caption = Srow12
RankLabel12.Caption = Rv12
SkillLabel13.Caption = Srow13
RankLabel13.Caption = Rv13
SkillLabel14.Caption = Srow14
RankLabel14.Caption = Rv14
SkillLabel15.Caption = Srow15
RankLabel15.Caption = Rv15
SkillLabel16.Caption = Srow16
RankLabel16.Caption = Rv16
SkillLabel17.Caption = Srow17
RankLabel17.Caption = Rv17
SkillLabel18.Caption = Srow18
RankLabel18.Caption = Rv18
SkillLabel19.Caption = Srow19
RankLabel19.Caption = Rv19
SkillLabel20.Caption = Srow20
RankLabel20.Caption = Rv20
End Sub