ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding zeros (https://www.excelbanter.com/excel-programming/294292-adding-zeros.html)

abxy[_43_]

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


Tom Ogilvy

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/




abxy[_44_]

Adding zeros
 
it worked! thanks mate!

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



All times are GMT +1. The time now is 10:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com