February 29th, 2012, 05:31 PM
Join Date: Jun 2008
Time spent in forums: 7 h 30 m 52 sec
Reputation Power: 5
Add text to multiple cells in Excel
I'm trying to write simple macros to add xml/html tags to cells in Excel. What I would like to have is that the user literally selects multiple cells in the same column, then fires the macro and it automatically adds the information before and after the text in the cells.
I've accomplished this part but it only adds it to the first (Active) cell in the selected cells. I can't seem to figure out how to make all the cells active so it knows to add text to the other selected cells as well.
Here is what I have for the macro so far:
FormulaR1C1 = _
FormulaR1C2 = _
ActiveCell = FormulaR1C1 & ActiveCell & FormulaR1C2
With ActiveCell.Characters(Start:=1, Length:=19).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
I'm VERY new to VB so any and all help is greatly appreciated!