Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding zeros

ok, i have a string of code in my userform that looks like this:

If Application.CountIf(ws.Cells.Range("A1:A275"), *"000"
TextBox1.Value*) 0 Then

now, the thing is, i've discovered that saying 000 and textbox1.valu
won't always give you the desired result, so, my question is, how can
alter that line of code to say, textbox1.value and keep adding zeros i
front of it, until there are 7 digits?

thanks for helping me out :

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Adding zeros

Right("0000000" & Textbox1.Value, 7)

--
Regards,
Tom Ogilvy

"abxy " wrote in message
...
ok, i have a string of code in my userform that looks like this:

If Application.CountIf(ws.Cells.Range("A1:A275"), *"000" &
TextBox1.Value*) 0 Then

now, the thing is, i've discovered that saying 000 and textbox1.value
won't always give you the desired result, so, my question is, how can i
alter that line of code to say, textbox1.value and keep adding zeros in
front of it, until there are 7 digits?

thanks for helping me out :)


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding zeros

it worked! thanks mate!

--
Message posted from http://www.ExcelForum.com

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
CONVERT NOs TO EAN 8 BY ADDING LEADING ZEROS pdb Excel Discussion (Misc queries) 7 February 13th 09 07:46 PM
adding zeros to numbers in columns Tim[_7_] Excel Discussion (Misc queries) 1 October 18th 07 03:39 AM
adding zeros to a cell DD Excel Discussion (Misc queries) 3 April 29th 05 07:56 PM
Adding Leading Zeros to Text Jenn Excel Discussion (Misc queries) 4 January 12th 05 06:51 PM
Adding leading zeros to a calculated value John Johndon Excel Programming 2 July 12th 03 06:25 PM


All times are GMT +1. The time now is 05:17 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"