Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can I use Select Case to do this? | Excel Programming | |||
Case without Select Case error problem | Excel Discussion (Misc queries) | |||
End Select without Select Case, Block If without End If errors | Excel Programming | |||
Case Select | Excel Programming |