Thread: Easy code!!!!
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default 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