PDA

View Full Version : Solved: change text in multiple cells with VBA



Gingertrees
12-11-2009, 02:42 PM
I get reports from our state database with long annoying irrelevant column headers. Can I have a routine that goes through and changes A1 from
"Long_annoying_header_321_other_uselessness"
into
"Employee"

B1 from
"Another_annoying_one"
into
"date"
etc. (There's 10 columns I'd like to change; the headers are always worded the exact same way.)

I already cooked up a little subroutine to trim out extra garbage, so I was wondering if I could just add that in.

lucas
12-11-2009, 03:38 PM
Sub InsertHeaderRow()
Dim myarray As Variant
myarray = Array("Heading 1", "Heading 2", "Heading 3", "Heading 4", "Heading 5")
Range("a1:e1").Value = myarray
End Sub

Gingertrees
12-11-2009, 03:45 PM
OK, how do I mark as solved now? Thread tools changed since the last I was here...
Lucas, you rock! Thanx!

lucas
12-11-2009, 04:02 PM
mark solved is not available under thread tools?

Gingertrees
12-12-2009, 04:46 AM
Hmm, I guess it was my browser. I switched to Firefox and things looked normal. I've attached a screenshot of what appears when you click thread tools in Google Chrome, f.y.r.

lucas
12-12-2009, 09:23 AM
I'll post a link to this in the admin forum and see what they think....

You still didn't mark it solved.....

Simon Lloyd
12-12-2009, 12:04 PM
Steve i heard this from a few folk now that it's not available to registered users, sound slike an IF conditional is mixed up.