+ Reply to Thread
Results 1 to 3 of 3

Macro to change the only table on worksheet, without specifying worksheet name

  1. #1
    Forum Contributor
    Join Date
    01-09-2016
    Location
    USA,USA
    MS-Off Ver
    2016
    Posts
    1,192

    Macro to change the only table on worksheet, without specifying worksheet name

    I have a log that I use monthly and a macro that inserts a new row into my log's table. New month = new log and new worksheet. But now my macro will not work because it wants to change last month's table. Manually changing the name of the table reference in the macro isn't hard, but is there an easier way? This is the macro I use.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Macro to change the only table on worksheet, without specifying worksheet name

    You can refer to a table by it's index.
    If it's the only table on the sheet that's active then your refer at with
    [fomula]ActiveSheet.ListObjects(1)[/formula]
    Cheers!
    Tsjallie




    --------
    If your problem is solved, pls mark the thread SOLVED (see Thread Tools in the menu above). Thank you!

    If you think design is an expensive waste of time, try doing without ...

  3. #3
    Forum Contributor
    Join Date
    01-09-2016
    Location
    USA,USA
    MS-Off Ver
    2016
    Posts
    1,192

    Re: Macro to change the only table on worksheet, without specifying worksheet name

    Thank you!

+ 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. Copying table to another sheet on worksheet change
    By LePig in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-22-2016, 03:07 PM
  2. Replies: 0
    Last Post: 02-11-2014, 02:14 PM
  3. How to create a macro which will fill a 'table' worksheet from another 'form' worksheet
    By tomgnihtemos in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-18-2013, 01:13 AM
  4. Macro to add worksheet - worksheet names change
    By PostID in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-13-2013, 01:05 PM
  5. Replies: 5
    Last Post: 01-26-2013, 01:55 PM
  6. Worksheet change with pivot table
    By Richard in forum Excel General
    Replies: 3
    Last Post: 02-20-2006, 06:25 PM
  7. [SOLVED] Cell value change to trigger macro (worksheet change event?)
    By Neil Goldwasser in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-10-2006, 10:00 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