Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You use If ElseIf in the following manner:
Sub UseIfElseIf() With Range("A1") If .Value = 1 Then 'do something ElseIf .Value = 2 Then 'do something else ElseIf .Value = 3 Then 'do something else again '' '' '' End If End With End Sub However, if there are a large number of ElseIf statements, and if the only 'true' statement is in one of the last ElseIfs's you'll find there's a speed increase by using Case Statements (they both follow the same logic) e.g. Sub SelectCase() Select Case Range("A1").Value Case 1 'do something Case 2 'do something else Case 3 'do something else again '' '' '' End Select End Sub HTH, John -- The major part of getting the right answer lies in asking the right question... "chemnks" wrote: i want to check code no(eg. 1,2,3,4,5) in a particular cell and for related code match i want to display a contents from other cell Please suggest |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
If function with certain condition | New Users to Excel | |||
conditional: stop function under certain condition | Excel Worksheet Functions | |||
max function with condition | Excel Discussion (Misc queries) | |||
adding part of a function on condition. | Excel Worksheet Functions | |||
IF Function with formatting condition | Excel Worksheet Functions |