Simple editing macro - struggling


Posted by Gideon on October 09, 2000 2:46 AM

I want to write a simple macro that will add a word after the current contents of the cell at the press of a hotkey. It was easy with old Lotus/Quattro, but with VBA I'm not getting anywhere. Basically, it should add " Station" after the "Cape Town" currently in the cell to state "Cape Town Station". I know I can do this with a bit of creative use of Find & Replace, but I'd like to do this with a macro for other related stuff too. If I record it, relative reference and all, it just copies "Cape Town Station" to all the cells where I activate the hotkey, it does not add " Station" as I want. (see macro below) Hope this makes sense.

Sub AddStn()
ActiveCell.FormulaR1C1 = "Cape Town Station"
ActiveCell.Offset(1, 0).Range("A1").Select
End Sub

Posted by Celia on October 09, 2000 2:53 AM

Gideon
To add "Station" to the active cell :-

ActiveCell.Value = ActiveCell.Value & " Station"

Celia



Posted by Gideon on October 09, 2000 5:20 AM

Thanks, Celia, I did not expect such a quick answer! And so embarrasingly simple too! Looks like I'll have to do a course in VBA or something, I just cannot get the hang of it without guidance.

Thanks again, it is exactly what I required.