+ Reply to Thread
Results 1 to 7 of 7

Update Table Header Date with VBA

  1. #1
    Registered User
    Join Date
    12-17-2013
    Location
    Greater NYC Area
    MS-Off Ver
    Excel 2010
    Posts
    84

    Update Table Header Date with VBA

    I've got a spreadsheet that my company has me update every quarter. I'm trying to automate the entire update process, but am quite new to VBA so need some help getting started.
    At the end of the day what I want to accomplish is to have VBA read a date from a specified “input” cell that I will manually fill in and update the dates in corresponding cells in other worksheets. However the cells in the other tabs are not purely date fields, they are a mix of string and date.

    In my first tab, labeled “input” I put in to cell A2 the quarter ending date (6/30/14). What I want VBA to do is read this input cell put that in to the correct table headings on the next tab. In the next tab I have three tables. The header for the second column heading of each of these tables reads "IRR as of <date>". I want to be able to click a button and have the <date> updated to the quarter ending date that I input on the first tab. The text part at the beginning of the header, "IRR as of", needs to remain the same. Only the date part should change.

    I don't think that my cell references will change, ie the tables will usually have the same number of rows and columns, but just in case these tables do end up moving around I'd like VBA to be able to look up the defined range (more specifically the table's name) and find the appropriate column.

    Thanks in advance
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Update Table Header Date with VBA

    Just type a valid quarter ending date!!!

    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Update Table Header Date with VBA

    Hi!

    Please see the file attached.

    Hope it helps!

    Dont forget to enable Macros if they already aren't

    Deep
    Attached Files Attached Files
    Cheers!
    Deep Dave

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Update Table Header Date with VBA

    Here is another option for you

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Registered User
    Join Date
    12-17-2013
    Location
    Greater NYC Area
    MS-Off Ver
    Excel 2010
    Posts
    84

    Re: Update Table Header Date with VBA

    Thanks a million guys. All three of these solutions work great.

    Can I just ask a quick follow up question? Is there any way to have VBA look for a specified named table range when spitting out the output? Currently the macros are putting the updated data in a specified cell which may or may not be the target cell in the next version. My concerns with the current solution are twofold.

    1) what if my tables move? Currently my column headers are found in G2, 10 and 18, but if a few more rows are added to one of the tables, then the output will be put in to a cell that doesn't correspond with the table header.

    2) In the real spreadsheet I have seven tabs each with six tables. It wouldn't be the end of the world to look up the cell references for each table column header, but it might be a smidge quicker if i can just tell VBA to spit out the output at "Sheet4.table18.columnheader2".

  6. #6
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Update Table Header Date with VBA

    Hi!

    Can I just ask a quick follow up question? Is there any way to have VBA look for a specified named table range when spitting out the output? Currently the macros are putting the updated data in a specified cell which may or may not be the target cell in the next version.
    The Solution which I have given is based on the Word "Partnership name". Wherever you put that word, the Date will come in the next cell..

    Deep

  7. #7
    Registered User
    Join Date
    12-17-2013
    Location
    Greater NYC Area
    MS-Off Ver
    Excel 2010
    Posts
    84

    Re: Update Table Header Date with VBA

    Quote Originally Posted by msexcelathome View Post
    The Solution which I have given is based on the Word "Partnership name". Wherever you put that word, the Date will come in the next cell..

    Deep
    You are absolutely right. I must have missed that. Thanks again!

+ 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. [SOLVED] Find specific value in table and return header row and header column value
    By nelwan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-30-2013, 01:35 AM
  2. [SOLVED] Extract the column header given the row header and highest value in a subset of a table
    By pguarino in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-20-2013, 02:05 AM
  3. Pivot Table Date Update Issue - Please Help
    By ThierrySem in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-07-2013, 07:43 AM
  4. [SOLVED] Macro to update pivot item (date format) in pivot table to latest date from data source.
    By rocksan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-10-2012, 03:18 AM
  5. [SOLVED] Populating Last Saved Date in Cell AND also update that same cell in Header
    By o0o_Bigs_o0o in forum Excel General
    Replies: 2
    Last Post: 07-04-2006, 08:10 AM

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