#1   Report Post  
Posted to microsoft.public.excel.programming
Jem Jem is offline
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 913
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 913
Default 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.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default 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.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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.




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
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
Call macro stored in Excel workbook from Outlook's macro Gvaram Excel Programming 0 October 4th 06 05:47 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
translate lotus 1-2-3 macro into excel macro using excel 2000 krutledge0209 Excel Programming 1 November 2nd 04 05:50 PM


All times are GMT +1. The time now is 11:36 AM.

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"