Thread: macros help...
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
parnless parnless is offline
external usenet poster
 
Posts: 2
Default macros help...

I copied the macro as you requested. I clicked on the cell with the number
6150 in it, hit Ctrl t, and the macro changed the number to 06150 and moved
one cell down. Sound good huh? I then hit Ctrl t again and the macro
changed the number in that cell to 06150. It just copied what I did in the
cell above. I need it to add a 0 in front of the number that is in the cell,
not keep putting the same number in it. Anyway, here is the macro named
Test1:

Sub Test1()
'
' Test1 Macro
' Macro recorded 3/13/2008
'
' Keyboard Shortcut: Ctrl+t
'
ActiveCell.FormulaR1C1 = "'06150"
With ActiveCell.Characters(Start:=1, Length:=5).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
Range("B16").Select
End Sub


"FSt1" wrote:

hi
me and lotus go back. before windows. before the mouse. i was writing macros
in lotus before windows. before excel. i understand your delema. but.... the
world has gone excel crazy. now a days, everyone thinks that excel is so much
better than lotus. ha....if they only knew. sigh. there is nothing in excel
that i haven't already done in lotus and the only thing i can tell is that
the menus are different .
i still have lotus and still use it.
but back to reality and the real world (as defined by Bill) . post your
code. me or someone might be able to edit it to your requirments.

regards
FSt1

"parnless" wrote:

I have a vertical list of 4 digit numbers that I want to add a zero(0) to the
beginning of the number. For example a number might be 3324 and I want to
add a 0 to the left of the 4 digits to end up looing like 03324. The problem
is this: This vertical list of numbers is almost 1200 lines deep. Some of
the numbers in this list are already 5 digits, whcih is what I want. I need
every number on each line to be 5 digits long. I did create a macro to add
the 0 to the 4 digit number, then drop down to the next line, but when I run
the macro again for the next line, it changes the number on the next line to
the same number on the line above. I want to be able to start in a cell, hit
Ctrl G and have it add a 0 to the 4 digit number in that cell, then drop down
a line and allow me to hit Ctrl G to do the same thing to the 4 digit number
in that particular cell.

The left column in the spreadsheet looks like this:
2345
2365
2476
2490
And when I get through I want it to look like this:
02345
02365
02476
02490

What it is doing now is this:
02345
02345
02345
02345

It's changing each number in each row to look exactly like the number in the
first row. I would appreciate any help anyone can offer. I used to use
Lotus 123 and did not have this kind of problems. Thanks in advance for any
advise or solutions.