I am a novice and I appreciate any assistance! I have a list of Doctor Specialty Codes numbered 1 through 130. Each number represents a particular specialty for example 1 is General Practice, 2 is General Surgery, etc. Whichever number is in cell A1 through cell A130 should display it's corresponding specialty in cell B1. I don't know which number may be in cell A1 because I get it from a changing data set with different Doctors. I tried using IF statements as shown below:
Since I don't know what number will be in A1 through A130 I have to include all numbers 1 through 130 in the code and this makes the code too big and inefficient. Can someone please show me how to efficiently do this. I think I should loop it but not sure how to do that. Thank You!!
Sub test()
If Range("A1").Value = 1 Then
Range("B1").Value = "General practice"
End If
If Range("A1").Value = 2 Then
Range("B1").Value = "General surgery"
End If
End Sub
Since I don't know what number will be in A1 through A130 I have to include all numbers 1 through 130 in the code and this makes the code too big and inefficient. Can someone please show me how to efficiently do this. I think I should loop it but not sure how to do that. Thank You!!
Sub test()
If Range("A1").Value = 1 Then
Range("B1").Value = "General practice"
End If
If Range("A1").Value = 2 Then
Range("B1").Value = "General surgery"
End If
End Sub