Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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

  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
Easy VB code question Anthony Excel Discussion (Misc queries) 2 July 8th 05 08:45 PM
new user with easy question? not easy for me speakeztruth New Users to Excel 5 June 3rd 05 09:40 PM
Easy Value listing code Todd Huttenstine[_2_] Excel Programming 1 November 29th 03 10:01 AM


All times are GMT +1. The time now is 03:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"