LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default unexpected result from inputbox

HRman wrote:
Hi,

I have a piece of code that promts for an employee number which may or may
not have a leading zero. If I print out the employee number using msgbox it
has the leading zero, but when i place it on a worksheet, the leading zero
disappears.

dim empno as string

empno = inputbox("enter the employee number")
msgbox ""+empno+"<"
worksheets("sheet1").cells(1,2).value = empno


Any suggestions ?


Because Execel treats your result as a number and cuts leading zeros.

worksheets("sheet1").cells(1,2).value = "'" & empno


 
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
Lookup returns unexpected result David Ryan Excel Worksheet Functions 4 April 2nd 09 09:35 PM
Unexpected Result Hardeep_kanwar[_2_] Excel Worksheet Functions 2 January 16th 09 03:29 PM
FV Function result is unexpected. RushatiINDIA Excel Worksheet Functions 8 February 28th 07 03:13 AM
Unexpected result Biff Excel Worksheet Functions 5 June 3rd 05 02:56 AM
FileSearch gives unexpected result Stephen Allen[_2_] Excel Programming 2 December 21st 03 01:06 PM


All times are GMT +1. The time now is 10:00 PM.

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

About Us

"It's about Microsoft Excel"