+ Reply to Thread
Results 1 to 5 of 5

need code that will convert a table to a range

  1. #1
    Registered User
    Join Date
    10-20-2013
    Location
    Wilder, Vermont
    MS-Off Ver
    Excel 2007
    Posts
    19

    need code that will convert a table to a range

    Hi,
    I'm not a programmer; I usually just create macros by recording them as I'm formatting output (and I edit them a bit), as the outputs I format are standard from month to month. However, I'm having a problem that I've never had before, in that when I try to record converting a table to range (an option on the ribbon in the tables tab, table options) for some reason, that action won't record. Is there any code that will accomplish conversion of a table to a range?

    The reason I want to do this is because when the table is created, it applies the filter at the wrong location, so I want to apply the filter to a different location, but keep the nice color formatting that is applied when output is formatted as a table. The weird thing is that even though when I use the "record macro button" it will record the steps in the creation of the table (insert table), but when the table has been created, and I choose "convert to range" in the tools section of table tools, the fact that I have selected this doesn't get recorded. I've been recording macros for many years now, and this is the first time I haven't been able to record an action. It has me stumped!

    Thanks, in advance for any suggestions!

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: need code that will convert a table to a range

    The .Unlist command will remove the table properties while leaving the pretty formatting behind.
    Replace Activecell reference with whatever anchoring method you need, but this is the syntax to do it:


    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    10-20-2013
    Location
    Wilder, Vermont
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: need code that will convert a table to a range

    Thank you, thank you. I'll try this tomorrow, and if it works I'll add to your reputation! I still don't understand why I wasn't able to record that action, but I'm very glad there is a way. I plan to use this on an iterative process which creates 50-70 separate worksheets, so if this does work it will be a huge timesaver!

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: need code that will convert a table to a range

    Glad to help.

    If that resolves your question, please select "Mark as Solved" from the Thread Tools at the top of the page. Thanks.

  5. #5
    Registered User
    Join Date
    10-20-2013
    Location
    Wilder, Vermont
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: need code that will convert a table to a range

    This worked perfectly, exactly as written! Thanks so much! I love this site, and so appreciate all the offers to help! You've made my day.... and you make me look good!!! Happy Easter... happy spring!

+ 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. VBA code to convert value in pivot table to text
    By cgabe001 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-08-2014, 12:11 PM
  2. [SOLVED] Macro to Convert Selected Range to Table
    By AHFoddeR in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-09-2013, 08:39 PM
  3. VBA Code to Convert Table to Normal Range
    By aloha31 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-01-2013, 07:38 PM
  4. Convert a dynamic data range into a table
    By Bippa88 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-08-2013, 03:08 AM
  5. Convert table data into list - VBA code
    By missy22 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-26-2012, 09:52 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