ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   excel macro (https://www.excelbanter.com/excel-programming/413943-excel-macro.html)

Jem

excel macro
 
hi to all,

I have this data 1234 in cell K27.
how to make macro that will add "0 to the beginning:

My data is:

1234

That the result will look like this:

"01234



Thanks,
Lorena


Lars-Åke Aspelin[_2_]

excel macro
 
On Sat, 12 Jul 2008 03:00:00 -0700 (PDT), Jem
wrote:

hi to all,

I have this data 1234 in cell K27.
how to make macro that will add "0 to the beginning:

My data is:

1234

That the result will look like this:

"01234



Thanks,
Lorena



try this macro:

Sub jem()
With ActiveSheet
.Cells(27, 11) = """0" & .Cells(27, 11)
End With
End Sub

Hope this helps / Lars-Åke

Don Guillett

excel macro
 
Or, you can just custom format as 00000

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Jem" wrote in message
...
hi to all,

I have this data 1234 in cell K27.
how to make macro that will add "0 to the beginning:

My data is:

1234

That the result will look like this:

"01234



Thanks,
Lorena



Lars-Åke Aspelin[_2_]

excel macro
 
On Sat, 12 Jul 2008 06:30:27 -0500, "Don Guillett"
wrote:

Or, you can just custom format as 00000



That will only give you the 0, not the " I guess.



Don Guillett

excel macro
 

I guess that's right if that's what OP wants???
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Lars-Åke Aspelin" wrote in message
...
On Sat, 12 Jul 2008 06:30:27 -0500, "Don Guillett"
wrote:

Or, you can just custom format as 00000



That will only give you the 0, not the " I guess.




Tom Ogilvy

excel macro
 
then you could use the custom number format \"00000

But the cell would still just contain 1234 - don't know what the OP wants
actually stored in the cell

for a macro:

Sub FormatCell
ActiveCell.NumberFormat = "\""00000"
End sub

--
Regards,
Tom Ogilvy


"Don Guillett" wrote:


I guess that's right if that's what OP wants???
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Lars-Ã…ke Aspelin" wrote in message
...
On Sat, 12 Jul 2008 06:30:27 -0500, "Don Guillett"
wrote:

Or, you can just custom format as 00000



That will only give you the 0, not the " I guess.






All times are GMT +1. The time now is 06:09 PM.

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