Consulting

Results 1 to 7 of 7

Thread: Solved: change text in multiple cells with VBA

  1. #1

    Question Solved: change text in multiple cells with VBA

    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.

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    [VBA]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[/VBA]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    OK, how do I mark as solved now? Thread tools changed since the last I was here...
    Lucas, you rock! Thanx!

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    mark solved is not available under thread tools?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5

    Exclamation thread tools dropdown doesn't work in Chrome

    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.

  6. #6
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    I'll post a link to this in the admin forum and see what they think....

    You still didn't mark it solved.....
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  7. #7
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    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.
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •