Hi, I'm trying to use select case to perform a specific set of actions based on an integer I pass when calling this class method.
The subroutine I'm trying to run passes 3 for the argument "Offsets".
When I check my immediates window ?Offsets returns 3. So I know this is working. The range "rngTarget" is also being passed properly.
But for some reason, when I step through the code manually, even though Offsets = 3, it never steps into that case. It just steps past all of them as if they are false.
I dont get any kind of error message, it just never steps into the case.
I dont understand this...what did I do wrong here?
Code in sub calling method and passing arguments:
Code in class ClaFeature that is not working correctly:
The subroutine I'm trying to run passes 3 for the argument "Offsets".
When I check my immediates window ?Offsets returns 3. So I know this is working. The range "rngTarget" is also being passed properly.
But for some reason, when I step through the code manually, even though Offsets = 3, it never steps into that case. It just steps past all of them as if they are false.
I dont get any kind of error message, it just never steps into the case.
I dont understand this...what did I do wrong here?
Code in sub calling method and passing arguments:
Code:
BPFeature.Output rngOutput, 3
Code:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub Output(rngTarget As Range, Offsets As Integer)
'''''''''''''''''''''''''
Dim lngTarget As Long
'''''''''''''''''''''''''
lngTarget = rngTarget.Rows.Row
Set rngTarget = Range("A" & lngTarget)
'''''''''''''''''''''''''
Select Case Offsets
'''''''''''''''''''''''''
Case Offsets = 1
With rngTarget
.Value = Me.Item
.Offset(0, 1).Value = Me.Description
End With
'''''''''''''''''''''''''
Case Offsets = 2
With rngTarget
.Value = Me.Item
.Offset(0, 1).Value = Me.Description
.Offset(0, 2).Value = Me.Method
End With
'''''''''''''''''''''''''
Case Offsets = 3
With rngTarget
.Value = Me.Item
.Offset(0, 1).Value = Me.Description
.Offset(0, 2).Value = Me.Method
.Offset(0, 3).Value = Me.Zone
End With
'''''''''''''''''''''''''
End Select
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Last edited: