Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Easy code!!!!
Hi
Can this code be written in one line!!!! thanks in advance If (InStr(1, ZoneNo, "us", vbTextCompare) 0) Then sREPORT_CODE = "999" ElseIf ZoneNo = 1 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 2 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 3 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 4 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 5 Then sREPORT_CODE = Format (ZoneNo, "000") End If |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Easy code!!!!
Hi Sudhendra,
Yes: If InStr(1, ZoneNo, "us", vbTextCompare) Then _ sREPORT_CODE = "999" Else sREPORT_CODE = _ Format(ZoneNo, "000") -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Sudhendra wrote: Hi Can this code be written in one line!!!! thanks in advance If (InStr(1, ZoneNo, "us", vbTextCompare) 0) Then sREPORT_CODE = "999" ElseIf ZoneNo = 1 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 2 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 3 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 4 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 5 Then sREPORT_CODE = Format (ZoneNo, "000") End If |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Easy code!!!!
Hi
though not one line but try If (InStr(1, ZoneNo, "us", vbTextCompare) 0) Then sREPORT_CODE = "999" elseif ZoneNo = 1 and ZoneNo <=5 then sREPORT_CODE = Format (ZoneNo, "000") end if -- Regards Frank Kabel Frankfurt, Germany Sudhendra wrote: Hi Can this code be written in one line!!!! thanks in advance If (InStr(1, ZoneNo, "us", vbTextCompare) 0) Then sREPORT_CODE = "999" ElseIf ZoneNo = 1 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 2 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 3 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 4 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 5 Then sREPORT_CODE = Format (ZoneNo, "000") End If |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Easy code!!!!
Thanks
-----Original Message----- Hi Sudhendra, Yes: If InStr(1, ZoneNo, "us", vbTextCompare) Then _ sREPORT_CODE = "999" Else sREPORT_CODE = _ Format(ZoneNo, "000") -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Sudhendra wrote: Hi Can this code be written in one line!!!! thanks in advance If (InStr(1, ZoneNo, "us", vbTextCompare) 0) Then sREPORT_CODE = "999" ElseIf ZoneNo = 1 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 2 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 3 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 4 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 5 Then sREPORT_CODE = Format (ZoneNo, "000") End If . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Easy code!!!!
Thanks
-----Original Message----- Hi though not one line but try If (InStr(1, ZoneNo, "us", vbTextCompare) 0) Then sREPORT_CODE = "999" elseif ZoneNo = 1 and ZoneNo <=5 then sREPORT_CODE = Format (ZoneNo, "000") end if -- Regards Frank Kabel Frankfurt, Germany Sudhendra wrote: Hi Can this code be written in one line!!!! thanks in advance If (InStr(1, ZoneNo, "us", vbTextCompare) 0) Then sREPORT_CODE = "999" ElseIf ZoneNo = 1 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 2 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 3 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 4 Then sREPORT_CODE = Format (ZoneNo, "000") ElseIf ZoneNo = 5 Then sREPORT_CODE = Format (ZoneNo, "000") End If . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
Easy VB code question | Excel Discussion (Misc queries) | |||
new user with easy question? not easy for me | New Users to Excel | |||
Easy Value listing code | Excel Programming |