Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default automatically fill up a cell?

hello

I like to know if its possible to automatically fill up a cell with
zero's if there are less then 8 digits filled in by the user.

For example:


12345678 - stays 12345678
2345678 - becomes 02345678
345678 - becomes 00345678
11111 - becomes 00011111

etcetera

Thanx in advance


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 634
Default automatically fill up a cell?

Format / Cells / Custom / 00000000

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------



"polletje " wrote in message
...
hello

I like to know if its possible to automatically fill up a cell with
zero's if there are less then 8 digits filled in by the user.

For example:


12345678 - stays 12345678
2345678 - becomes 02345678
345678 - becomes 00345678
11111 - becomes 00011111

etcetera

Thanx in advance


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



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.558 / Virus Database: 350 - Release Date: 02/01/2004


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default automatically fill up a cell?

Go to:
Format-Cell
Tab(Numbers)
Category: Custom
Type: 00000000

-----Original Message-----
hello

I like to know if its possible to automatically fill up a

cell with
zero's if there are less then 8 digits filled in by the

user.

For example:


12345678 - stays 12345678
2345678 - becomes 02345678
345678 - becomes 00345678
11111 - becomes 00011111

etcetera

Thanx in advance


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

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default automatically fill up a cell?

Here's an example with code:

Sub EightDigits()
Dim A As Integer
For A = 5 To 15
Cells(A, 5).NumberFormat = "00000000"
Next A
End Sub


-----Original Message-----
hello

I like to know if its possible to automatically fill up a

cell with
zero's if there are less then 8 digits filled in by the

user.

For example:


12345678 - stays 12345678
2345678 - becomes 02345678
345678 - becomes 00345678
11111 - becomes 00011111

etcetera

Thanx in advance


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

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default automatically fill up a cell?

thnx, works great. Just one little question.
When i copy and paste it in macro, in the destination file it shows
the original value. Is there a way to set the created value to a fixed
value??


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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default automatically fill up a cell?

another possibility based more on the subject title
than what you asked for in your question by way of the
examples would be to use the asterisk to define a
fill character in this case the fill character is an asterisk.
_(**$#,##0.00_);[Red]_(**$(#,##0.00);_(**$0.00_);_(@_)

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"polletje " wrote in message ...
thnx, works great. Just one little question.
When i copy and paste it in macro, in the destination file it shows
the original value. Is there a way to set the created value to a fixed
value??


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



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default automatically fill up a cell?

thnx, works great. Just one little question.
When i copy and paste it in macro, in the destination file it shows
the original value. Is there a way to set the created value to a fixe
value?

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

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default automatically fill up a cell?

in the workbook
=TEXT(A1,"00000000")

in VBA see "Format Function Example"
cell.value = format(myNumber,"00000000")
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"polletje " wrote in message ...
thnx, works great. Just one little question.
When i copy and paste it in macro, in the destination file it shows
the original value. Is there a way to set the created value to a fixed
value??


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



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default automatically fill up a cell?

I'm not sure what you mean...but I'm guessing that this is
what you may want.

Sub EightDigitsR1()
Dim A As Integer
Dim B As Byte

For A = 5 To 15
For B = 1 To 8
If Len(Cells(A, 5).Value) = B Then
Cells(A, 5).Value = "'" & _
String(8 - B, "0") & Cells(A, 5).Value
Else
Cells(A, 5).Value = "'" & Cells(A, 5).Value
End If
Next B
Next A

End Sub

-----Original Message-----
thnx, works great. Just one little question.
When i copy and paste it in macro, in the destination

file it shows
the original value. Is there a way to set the created

value to a fixed
value??


---
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
How can I automatically fill the remainder of a cell with dots (.. Tom Excel Discussion (Misc queries) 2 April 4th 23 10:35 AM
Automatically fill following cells depending on one cell. Dezzie Excel Discussion (Misc queries) 6 March 31st 09 07:49 PM
Getting a prompt to automatically fill a cell Zahra Excel Discussion (Misc queries) 0 April 30th 08 09:13 PM
Automatically fill cell value ingalla Excel Worksheet Functions 1 March 28th 07 08:58 PM
How do I automatically fill a cell based on another cell in Excel SouthCarolina Excel Discussion (Misc queries) 3 January 13th 06 12:52 AM


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