Macro to edit text?

Spage

New Member
Joined
Aug 25, 2002
Messages
4
Is it possible to use a Macro to edit the contents of a cell? If, for example, I wanted to add something at the beginning of the text in a column of cells?

I have fond memories of being able to do this quite simply way back when (in Lotus), but even with the Relative Reference selected it ends up something like this:

Sub Edit()
'
' Edit Macro
' Macro recorded 8/26/2002 by spage
' ActiveCell.FormulaR1C1 = " Aldine ISD"
ActiveCell.Offset(1, 0).Range("A1").Select
End Sub

Just so you'll know............. I'm trying to figure out what users who are not programers (and don't want to be) can and can't do with Macros. I'm putting togeather a course on Excel Macros for our staff.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Thanks, guess I don't get it yet...

range("a1").value = "hi " & range("a1").value

--How can I get it to add "hi " to the beginning of the cell that is active in the spreadsheet? I seem to only be able to effect the same cell over and over...

Thanks again for your help.
 
Upvote 0
Do you need to do it to multiple cells? If you just need to do the activecell, it would be either one:

activecell.value = "whatever you want" & activecell.value

or

selection.value = "whatever you want" & selection.value

I would suggest using activecell though, not selection.

Hope this helps.
This message was edited by zacemmel on 2002-08-26 13:55
 
Upvote 0

Forum statistics

Threads
1,218,625
Messages
6,143,578
Members
450,493
Latest member
Woejeber

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top