Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I automatically fill the remainder of a cell with dots (.. | Excel Discussion (Misc queries) | |||
Automatically fill following cells depending on one cell. | Excel Discussion (Misc queries) | |||
Getting a prompt to automatically fill a cell | Excel Discussion (Misc queries) | |||
Automatically fill cell value | Excel Worksheet Functions | |||
How do I automatically fill a cell based on another cell in Excel | Excel Discussion (Misc queries) |