+ Reply to Thread
Results 1 to 7 of 7

Macro to automatically rename row headers

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-30-2007
    Location
    London, UK
    MS-Off Ver
    Microsoft Office 2007
    Posts
    317

    Macro to automatically rename row headers

    Hi guys,

    Where I work we use a database called Trent and sometimes we need to use a tool called Business Objects to run reports from this database. The trouble is that Trent uses headings that BO cannot deal with and I need a macro that can automatically rename the headers to something that BO can readily use to run reports.

    I have attached two spreadsheets one called 'Column Heading Differences' and the other called 'Sample of Export from Business Objects'.

    The first spreadsheet 'Column Heading Differences' this explains exactly what I need. Basically in row 9 this is what the extracted report names the headers, however I need the named headers as they appear in row 3.

    Now if you look at the second spreadsheet entitled 'Sample of Export from Business Objects' this is how the extracted report looks like.

    This second spreadsheet is the one where I need a Macro to change the field names in row 10 into something into names that BO can actually use.

    It would be really helpful to automate this via a macro as it is quite time consuming to manually keep changing the names of the cells. Seeing as my VBA skills are pretty useless, i was wondering if some kind person would be able to write a small piece of code to help me with my problem.

    Thanks in advance for any help given.
    Attached Files Attached Files
    Last edited by VBA Noob; 06-09-2008 at 07:47 AM.
    Best Regards.

    Michael
    -----------------------------------
    Windows Vista, Microsoft Office 2007

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You need to make sure the Row & sheet references are correct, but something like this
    Option Explicit
    
    Sub changeheaders()
        With Sheet1
            .Cells(9, 1).Value = "Name"
            .Cells(9, 2).Value = "Position"
        End With
    End Sub
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    03-30-2007
    Location
    London, UK
    MS-Off Ver
    Microsoft Office 2007
    Posts
    317

    Thumbs up

    Hi RoyUK,

    Thank you so much this works perfectly. How can I make this macro available to all open worksheets so that I don't have to keep inserting modules each time I run this report?

    Thanks.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Change With Sheet1 to With Activesheet & it will work on the currently open sheet.

  5. #5
    Forum Contributor
    Join Date
    03-30-2007
    Location
    London, UK
    MS-Off Ver
    Microsoft Office 2007
    Posts
    317

    Smile

    Quote Originally Posted by royUK
    Change With Sheet1 to With Activesheet & it will work on the currently open sheet.
    Sorry for the late feedback, Thanks for your help. What I wanted to know though is how can I make this Macro always available as soon as I open Excel? I am assuming it would have to be in the shape of an 'Add-In'?

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    If you o0nly need it on the one PC you can use PERSONAL.xls, to share it then an addin would be best.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro for all tabs Headers and Page breaks
    By sammar12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-11-2008, 03:26 AM
  2. Macro to automatically hit database using password
    By piyushdabomb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-13-2007, 12:43 PM
  3. running a macro automatically
    By gbWildy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-19-2007, 03:16 PM
  4. Macro to rename and move files
    By Caroline25 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-15-2007, 03:11 PM
  5. macro to run automatically
    By vandanavai in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-03-2006, 07:41 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1