+ Reply to Thread
Results 1 to 3 of 3

Create a Table Style With VBA

  1. #1
    Registered User
    Join Date
    12-02-2021
    Location
    PA, USA
    MS-Off Ver
    Office 365
    Posts
    20

    Angry Create a Table Style With VBA

    I am trying to create a few table styles using VBA. I'm having a difficult time of finding examples on the internet. I keep getting an "Application-defined or object-defined" error when I start modifying the color properties, ".Interior.PatternColorIndex = -4105".

    Using the Watch tool I can see the property is there. What I'm doing wrong to get this error? Thanks!
    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    11-26-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    419

    Re: Create a Table Style With VBA

    Copying and pasting your code worked fine for me. -4105 = xlAutomatic. Are you changing this to other values? I don't tend to use patterns, but after a bit of playing around, it looks like only values from -1 to 56 work (and -4105).

  3. #3
    Registered User
    Join Date
    12-02-2021
    Location
    PA, USA
    MS-Off Ver
    Office 365
    Posts
    20
    Quote Originally Posted by mgs73 View Post
    Copying and pasting your code worked fine for me. -4105 = xlAutomatic. Are you changing this to other values? I don't tend to use patterns, but after a bit of playing around, it looks like only values from -1 to 56 work (and -4105).
    😖 It’s working for me now as well. Not sure what was going on earlier other than I probably should have taken a break and walked away for a little bit.

    In answer to your question I was using xlAutomatic but switched to the integer in hopes that maybe that was causing an issue. Thank you for “fixing” it for me. 😉

+ 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. Create Word-Table with Excel-VBA and style it
    By jumbo125 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-03-2020, 03:00 AM
  2. create option style table
    By ajitexcel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-27-2019, 03:22 AM
  3. Create TABLE STYLE for all workbooks
    By cgampon in forum Excel General
    Replies: 0
    Last Post: 07-19-2017, 05:07 PM
  4. [SOLVED] Transform Data From Pivot Style to a Table Style
    By The_Snook in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-18-2016, 04:13 AM
  5. [SOLVED] Create Table Style Macro Not Producing Expected Results
    By mcclanat in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-19-2015, 10:47 AM
  6. Create Pivot-style table without using a pivot
    By myslin in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 07-26-2013, 01:08 PM
  7. Create Style for all workbooks
    By djblois1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-01-2011, 11:20 AM

Tags for this Thread

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