+ Reply to Thread
Results 1 to 6 of 6

I run a macro which changes attributes of a cell and then cannot restore gridlines

  1. #1
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Akron, OH
    MS-Off Ver
    15.0
    Posts
    424

    I run a macro which changes attributes of a cell and then cannot restore gridlines

    (...cannot see the gridlines -- they're there but somehow hidden).

    I run this macro across my workbook, it changes cell properties, and then I am unable to see gridlines. When I use excel's ribbon in the program to turn off all gridlines and turn on all gridlines, there is no change. Here is what I mean by gridlines: https://support.office.com/en-us/art...a-b26f4adc3fb4

    Every cell this code loops over results in a hidden gridline. MsgBox(C.Application.ActiveWindow.DisplayGridlines) displays "True" so there is no point to running code:
    WS.Activate
    ActiveWindow.DisplayGridlines = True

    That leads me to believe there is an attribute of each Cell: C that is changed; but I don't know what attribute is changed.

    I wish there was a way to list all attributes of a cell so I can more easily figure this out, but an Excel 2007 machine I have doesn't have a TypeLib.dll and neither does mine so I can't follow the suggestions of others who have gone down that path (if I'm understanding that correctly)

    Here is my macro that unintentionally hides gridlines, despite the fact that MsgBox(C.Application.ActiveWindow.DisplayGridlines) is True, where C is ANY cell in the workbook -- but now that I think about it, perhaps that would always be True or that would always be False for any cell in the same worksheet... no matter, another lesson for another day.
    Please Login or Register  to view this content.
    If someone has the dll necessary to run the following code, I would appreciate seeing the results!
    Please Login or Register  to view this content.
    Last edited by joe31623; 01-09-2016 at 01:34 AM.
    <---If my answer helped, please click *

  2. #2
    Forum Contributor
    Join Date
    01-08-2016
    Location
    Cagayan De Oro City, Philippines
    MS-Off Ver
    2013
    Posts
    152

    Re: I run a macro which changes attributes of a cell and then cannot restore gridlines

    Hi

    Not sure if this is the problem, and i have no idea what the dll is doing but ...

    Please Login or Register  to view this content.
    it maybe that the gridlines are hidden by the background color, also in the view pane on the ribbon can you check and uncheck the gridlines, have you also checked the color of the gridlines in the options, have you also tried setting the fill to 'None'?

    Just throwing some ideas around, give them a try.

    Thanks
    Paul Smith

  3. #3
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Akron, OH
    MS-Off Ver
    15.0
    Posts
    424

    Re: I run a macro which changes attributes of a cell and then cannot restore gridlines

    Paul,

    Good suggestion. When I ran that code with modification:
    Please Login or Register  to view this content.
    I got the same value: 16777215 (for cells with no interior color), in both Message Boxes, which leads me to believe it's not being changed. Just to verify I'm seeing that value change with color, I ran the code after manually setting the interior color of one cell to yellow and got 65535 for both values: .Interior.Color and .DisplayFormat.Interior.Color.

    The purpose of the macro is to go through the workbook, set all colored cells that are colored based on conditional formatting to the color they are (regardless of conditional formatting) and then remove the conditional formatting.
    Last edited by joe31623; 01-09-2016 at 01:00 AM.

  4. #4
    Forum Contributor
    Join Date
    01-08-2016
    Location
    Cagayan De Oro City, Philippines
    MS-Off Ver
    2013
    Posts
    152

    Re: I run a macro which changes attributes of a cell and then cannot restore gridlines

    if you set a color using

    Please Login or Register  to view this content.
    Try this

    Thanks
    Paul S.

  5. #5
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Akron, OH
    MS-Off Ver
    15.0
    Posts
    424

    Re: I run a macro which changes attributes of a cell and then cannot restore gridlines

    THANKS, Paul!

    That was exactly what I needed.

  6. #6
    Forum Contributor
    Join Date
    01-08-2016
    Location
    Cagayan De Oro City, Philippines
    MS-Off Ver
    2013
    Posts
    152

    Re: I run a macro which changes attributes of a cell and then cannot restore gridlines

    No Problem

+ 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. Macro to Get File Attributes
    By Brawnystaff in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-25-2015, 07:12 PM
  2. Macro to get file attributes - length
    By Brawnystaff in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-24-2015, 12:51 PM
  3. [SOLVED] In Excel, gridlines won't print--File,PageSetup,Sheet,Gridlines--
    By 4most in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 07-10-2006, 03:29 AM
  4. Some gridlines missing - How to restore
    By Oliver Costich in forum Excel General
    Replies: 2
    Last Post: 03-29-2006, 02:25 PM
  5. how to restore worksheet's gridlines &amp;amp; attributes
    By xppuser in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-15-2006, 01:35 PM
  6. [SOLVED] Macro (attributes?)
    By Brad in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-06-2005, 11:25 AM
  7. [SOLVED] Restore Gridlines
    By JayVee in forum Excel General
    Replies: 1
    Last Post: 03-03-2005, 09:06 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