epactheactor
New Member
- Joined
- Sep 9, 2015
- Messages
- 38
I'm having an issue that I've never come across. For some reason it is as if VBA isn't reading what the value inside a variable is.
I've posted the variables and part of the code that is giving the grief below as the entire code is pretty long.
The code defaults to the first if statement. I've gone step by step and VBA will show the correct value of the manufYear variable, but it continues to default to the first if statement despite the value. I've seen it read that manufYear (1972) <= 1967.
What am I doing wrong? I would think it is the data type that is giving the issue, but I'm not having this issue with any other manuf in my code. I've changed the data type multiple time from Integer to Long, to Variant, etc.
Thank you for any help.
The values I've been using are:
seam = "HFERW"
manufYear = 1972
manuf = "J&L"
I've posted the variables and part of the code that is giving the grief below as the entire code is pretty long.
The code defaults to the first if statement. I've gone step by step and VBA will show the correct value of the manufYear variable, but it continues to default to the first if statement despite the value. I've seen it read that manufYear (1972) <= 1967.
What am I doing wrong? I would think it is the data type that is giving the issue, but I'm not having this issue with any other manuf in my code. I've changed the data type multiple time from Integer to Long, to Variant, etc.
Thank you for any help.
The values I've been using are:
seam = "HFERW"
manufYear = 1972
manuf = "J&L"
Code:
Dim manuf As String
Dim seam As String
Dim manufYear As Variant
ElseIf seam = "HFERW" And manufYear <= 1967 And manuf = "Jones & Laughlin" Or manuf = "J&L" Or manuf = "j&l" Or manuf = "J & L" Or manuf = "j & l" Then
A = 1
B = 2.2
C = 1
D= 2.1
E = 0.6
ElseIf seam = "HFERW" And manufYear >= 1968 And manufYear <= 1979 And manuf = "Jones & Laughlin" Or manuf = "J&L" Or manuf = "j&l" Or manuf = "J & L" Or manuf = "j & l" Then
A = 1
B = 2.2
C = 1
D = 3.75
E = 0.7
ElseIf seam = "HFERW" And manufYear >= 1980 And manuf = "Jones & Laughlin" Or manuf = "J&L" Or manuf = "j&l" Or manuf = "J & L" Or manuf = "j & l" Then
A = 1
B = 2.2
C = 1
D = 4.6
E = 0.7
ElseIf seam = "LFERW" And manufYear >= 1957 And manufYear <= 1965 And manuf = "Jones & Laughlin" Or manuf = "J&L" Or manuf = "j&l" Then
A = 1
B = 1
C = 1
D = 1.5
E = 0.2
Last edited: