+ Reply to Thread
Results 1 to 6 of 6

Command Button - VBA To Insert Table Row not copying Table Format for Percent

  1. #1
    Registered User
    Join Date
    08-26-2021
    Location
    St. Louis, MO
    MS-Off Ver
    2016
    Posts
    15

    Command Button - VBA To Insert Table Row not copying Table Format for Percent

    The attached sample is from a much larger workbook that includes multiple tables and a user form to populate the main database. I have inserted a table on the dashboard with a command button to insert a row. The VBA code is simple enough and a row is properly added when executed. The problem is, the column with a percentage format is being copy with a $ format instead of a % format. I copied the range to a table and reinput the formulas and formats in the first row and reconverted it to a table, but the issue persists.
    Attached Files Attached Files

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,410

    Re: Command Button - VBA To Insert Table Row not copying Table Format for Percent

    select the entire column and format it (%) it will stay formatted as the table expands
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  3. #3
    Registered User
    Join Date
    08-26-2021
    Location
    St. Louis, MO
    MS-Off Ver
    2016
    Posts
    15

    Re: Command Button - VBA To Insert Table Row not copying Table Format for Percent

    Hi Again Torachan

    Sorry my original attachment was not saved as macro enabled. I tried your suggestion before I posted the thread and again after your response to make sure. It's still changing the percent format to dollars. All other formats including my borders and the dollar and bold formatting on the COST column works fine. The attached sample is macro enabled.
    Attached Files Attached Files

  4. #4
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,410

    Re: Command Button - VBA To Insert Table Row not copying Table Format for Percent

    works for me after I had removed the two rows with $ showing.
    Did you format the entire column ?
    There should be no need to add extra rows as tables expand dynamically if you type something in the cell immediately under the table.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-26-2021
    Location
    St. Louis, MO
    MS-Off Ver
    2016
    Posts
    15

    Re: Command Button - VBA To Insert Table Row not copying Table Format for Percent

    That is really odd. It does not work for me no matter what I do. I can't format the entire column because it is part of a larger dashboard. In both my main project and this example, it will not retain the percent format.

    In the example and my main project, I tried again to convert it back to a range to reset the formulas and formats and then re-converted it back to a range. I also formatted the entire column in my example. Still no dice. I inserted a table row manually with the same results. This is a huge mystery as to why you have success and I don't. I hope I'm not forced to write unnecessary code. Actually, I'll probably abandon the command button before Igo through all that work and train my users to insert a table row and copy the formatting down.


  6. #6
    Registered User
    Join Date
    08-26-2021
    Location
    St. Louis, MO
    MS-Off Ver
    2016
    Posts
    15

    Smile Re: Command Button - VBA To Insert Table Row not copying Table Format for Percent

    Hi Torachan,

    I exhausted all the advice I could find to no avail. I took a different route to solve my problem. VBA. I simply named the errant range within my table and instructed it to format the range as percent and viola, my problem is solved. Thanks for your help!!

    I had a similar issue with my main data table though, where the alignment on 2 of 40 fields in a row would not copy down. I followed your advice on those columns of data and the alignment formatting copies down correctly.

    I guess the issue with the first table will remain a mystery.

    Ken

    [SOLVED]

+ 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] Delete Table Row command button
    By DropAGearN'Disappear in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-19-2021, 12:37 PM
  2. [SOLVED] Copying ActiveX Command Button from master sheet to subsheets. command button code missing
    By popper08 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-13-2020, 10:15 AM
  3. Command button to insert row at intersection in a table
    By Georgethethird in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-17-2015, 06:09 PM
  4. How To Colour a cell in a table using command button
    By souharda in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-26-2014, 01:52 AM
  5. [SOLVED] Link command button to row in table
    By r2fro in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-23-2013, 10:22 AM
  6. [SOLVED] How to make a Command button run the "FORM" command to fill/populate a table?
    By jrobin7 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-21-2012, 12:26 PM
  7. Cycle Through Table Data Using a Command Button
    By bennon05 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-13-2012, 02:28 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