View Single Post
Old 07-12-2005, 01:12 PM   #1 (permalink)
smileygladhands
 
Ultra Techie

Join Date: Mar 2005

Posts: 500

smileygladhands

Unhappy Need help with simple vba script for Excel macro

I have a column for about 4000 accounts on Excel. Each of them needs to have ('0 ) - without the parenthesis - added to the beginning of the account. I tried recording a macro that recorded me selecting the beginning of the text in the cell and typing '0. However, when I run the macro on other cells it replaces the new account number with all of the text of the cell that I recorded the macro in.
Here's the script:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Sub add_0()
'
' add_0 Macro
' Macro recorded 07/12/2005 by a371261
'
' Keyboard Shortcut: Ctrl+q
'
ActiveCell.FormulaR1C1 = "'069049000"
Range("C11").Select
End Sub
Sub Macro7()
'
' Macro7 Macro
' Macro recorded 07/12/2005 by a371261
'
' Keyboard Shortcut: Ctrl+t
'
Application.CommandBars("Stop Recording").Visible = False
Application.WindowState = xlMinimized
Application.Goto Reference:="add_0"
End Sub
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Obviously, I'm not very proficient with vbase... how can I edit the above so when I highlight the rest of the cells, it places '0 at the beginning of each account number?

Thanks for any help.

__________________
<a href=\"http://www.democracynow.org\"><img src=\"http://i5.photobucket.com/albums/y165/smileygladhands/linkbanner468x60.gif\" border=\"0\"></a>
\"All over the place, from the popular culture to the propaganda system, there is constant pressure to make people feel that they are helpless, that the only role they can have is to ratify decisions and to consume.\" -Noam Chomsky
smileygladhands is offline