Thread: Select Case
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Aaron Aaron is offline
external usenet poster
 
Posts: 287
Default Select Case

Hello All,

I have the following Code giving me some problems. Can anyone help? I have
little knowledge of VBA. Thanks in advance.

Public Sub Username2Line()



Dim LastRowWS As Long
LastRowWS = Cells(Rows.Count, "A").End(xlUp).Row


Do Until ActiveCell = ("H" & (LastRowWS))
Select Case ActiveCell.Value

Case "MFG1"

If ActiveCell.Offset(0, 1).Value = "10FS" Then
ActiveCell.Offset(0, 2).Value = "Correct"
Else
ActiveCell.Offset(0, 2).Value = "Incorrect Location"
End If

Case "MFG11"

If ActiveCell.Offset(0, 1).Value = "80FS" Then
ActiveCell.Offset(0, 2).Value = "Correct"
Else
ActiveCell.Offset(0, 2).Value = "Incorrect Location"
End If

Case "MFG15"

If ActiveCell.Offset(0, 1).Value = "VTFS" Then
ActiveCell.Offset(0, 2).Value = "Correct"
Else
If ActiveCell.Offset(0, 1).Value = "TSFS" Then
ActiveCell.Offset(0, 2).Value = "Correct"
Else
If ActiveCell.Offset(0, 1).Value = "LUMFS" Then
ActiveCell.Offset(0, 2).Value = "Correct"
Else
ActiveCell.Offset(0, 2).Value = "Incorrect Location"
End If

Case "MFG16"

If ActiveCell.Offset(0, 1).Value = "STGFS" Then
ActiveCell.Offset(0, 2).Value = "Correct"
Else
ActiveCell.Offset(0, 2).Value = "Incorrect Location"
End If

Case "MFG17"

If ActiveCell.Offset(0, 1).Value = "35FS" Then
ActiveCell.Offset(0, 2).Value = "Correct"
Else
ActiveCell.Offset(0, 2).Value = "Incorrect Location"
End If

Case "MFG18"

If ActiveCell.Offset(0, 1).Value = "DPFS" Then
ActiveCell.Offset(0, 2).Value = "Correct"
Else
ActiveCell.Offset(0, 2).Value = "Incorrect Location"
End If

Case "MFG4"

If ActiveCell.Offset(0, 1).Value = "70FS" Then
ActiveCell.Offset(0, 2).Value = "Correct"
Else
ActiveCell.Offset(0, 2).Value = "Incorrect Location"
End If

Case "MFG5"

If ActiveCell.Offset(0, 1).Value = "VTFS" Then
ActiveCell.Offset(0, 2).Value = "Correct"
Else
ActiveCell.Offset(0, 2).Value = "Incorrect Location"
End If

Case "MFG7"

If ActiveCell.Offset(0, 1).Value = "70FS" Then
ActiveCell.Offset(0, 2).Value = "Correct"
Else
ActiveCell.Offset(0, 2).Value = "Incorrect Location"
End If

Loop


End Select


End Sub