This is my code which I use in conjunction with a drop-down list. The "ni" range is the output range for the drop-down box. The "n" in the case statements is the value I want associated with the "ni", and the "nval" is the output where the value for "n" goes. When I try to run this code, The value for "n" that is returned is 0. I am not very good at vba and therefore cannot find where my problem is. This is the code.
Sub Roughness()
Dim n As Integer
Select Case Range("ni")
Case 1
n = 0.011
Case 2
n = 0.012
Case 3
n = 0.015
Case 4
n = 0.022
Case 5
n = 0.011
Case 6
n = 0.03
Case 7
n = 0.035
Case 8
n = 0.04
Case 9
n = 0.009
Case 10
n = 0.01
Case 11
n = 0.012
Case 12
n = 0.011
Case 13
n = 0.019
End Select
Range("nval").Value = n
End Sub
I have another Select Case sub in my program that works perfectly, and has the same format as this one.
Bookmarks