Select Case Behaving Oddly
I have been creating a spreadsheet that copies info from an User Form into
the appropriate row of sheet.
And all was working well until the other day.
I have not made any changes to the code in question, so I am confused as to
what is happening.
The fields in the User Form to be saved have Numeric Tags added to them, and
all work except for the field with the Tag number 6.
The Code is at the bottom of the post.
It should follow the Case Else code, but instead follows the Case 51 To 65.
I cant work out why
And the company now wants to roll out the sheet across multiple offices, so
I need to get this fixed rather sharpish.
Any help will be very much appreciated
Thanks
Kris
===============================================
The Offending Code!!
With dbs_SOR.Range("A1")
'Loop through Controls
For Each ctlInfo In Me.Controls
'if Tag is Numeric, it is a Data Entry Control
If IsNumeric(ctlInfo.Tag) Then
'Send Data to the worksheet
Select Case ctlInfo.Tag
Case 3
.Offset(lRow - 1, ctlInfo.Tag).Value = "01-" &
ctlInfo.Value
Case 22 To 33
If ctlInfo.Value = True Then
.Offset(lRow - 1, ctlInfo.Tag).Value = 1
Else
.Offset(lRow - 1, ctlInfo.Tag).Value = 0
End If
Case 41 To 44
If ctlInfo.Value = True Then
.Offset(lRow - 1, 11).Value = ctlInfo.Caption
End If
Case 51 To 65
If ctlInfo.Value = True Then
.Offset(lRow - 1, 12).Value = ctlInfo.Caption
End If
Case Else
.Offset(lRow - 1, ctlInfo.Tag).Value = ctlInfo.Value
End Select
End If
Next ctlInfo
End With
|