S
Steve
How can I make the follwoing code smaller?
Sub DoSwipeCheck(ByVal SwipeId)
If Worksheets("Cashiers").Range("D6").Value = SwipeId Then
GetNameFromSwipe ("C6")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D7").Value = SwipeId Then
GetNameFromSwipe ("C7")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D8").Value = SwipeId Then
GetNameFromSwipe ("C8")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D9").Value = SwipeId Then
GetNameFromSwipe ("C9")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D10").Value = SwipeId Then
GetNameFromSwipe ("C10")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D11").Value = SwipeId Then
GetNameFromSwipe ("C11")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D12").Value = SwipeId Then
GetNameFromSwipe ("C12")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D13").Value = SwipeId Then
GetNameFromSwipe ("C13")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D14").Value = SwipeId Then
GetNameFromSwipe ("C14")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D15").Value = SwipeId Then
GetNameFromSwipe ("C15")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D16").Value = SwipeId Then
GetNameFromSwipe ("C16")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D17").Value = SwipeId Then
GetNameFromSwipe ("C17")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D18").Value = SwipeId Then
GetNameFromSwipe ("C18")
Sheets("CustomerDetails").Select
Else
End If
End Sub
---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 080114-3, 14/01/2008
Tested on: 15/01/2008 12:28:32
avast! - copyright (c) 1988-2008 ALWIL Software.
http://www.avast.com
Sub DoSwipeCheck(ByVal SwipeId)
If Worksheets("Cashiers").Range("D6").Value = SwipeId Then
GetNameFromSwipe ("C6")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D7").Value = SwipeId Then
GetNameFromSwipe ("C7")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D8").Value = SwipeId Then
GetNameFromSwipe ("C8")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D9").Value = SwipeId Then
GetNameFromSwipe ("C9")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D10").Value = SwipeId Then
GetNameFromSwipe ("C10")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D11").Value = SwipeId Then
GetNameFromSwipe ("C11")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D12").Value = SwipeId Then
GetNameFromSwipe ("C12")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D13").Value = SwipeId Then
GetNameFromSwipe ("C13")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D14").Value = SwipeId Then
GetNameFromSwipe ("C14")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D15").Value = SwipeId Then
GetNameFromSwipe ("C15")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D16").Value = SwipeId Then
GetNameFromSwipe ("C16")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D17").Value = SwipeId Then
GetNameFromSwipe ("C17")
Sheets("CustomerDetails").Select
ElseIf Worksheets("Cashiers").Range("D18").Value = SwipeId Then
GetNameFromSwipe ("C18")
Sheets("CustomerDetails").Select
Else
End If
End Sub
---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 080114-3, 14/01/2008
Tested on: 15/01/2008 12:28:32
avast! - copyright (c) 1988-2008 ALWIL Software.
http://www.avast.com