+ Reply to Thread
Results 1 to 3 of 3

How do I return to a variable the cell's fill effects and border properties?

  1. #1
    Registered User
    Join Date
    01-20-2011
    Location
    Richmond, VA
    MS-Off Ver
    Excel 2007
    Posts
    2

    How do I return to a variable the cell's fill effects and border properties?

    See plenty of info on how to set a cell's fill and border. I however would like to know how to get the properties of a cell's gradient (both colors, shading style, and variant). I would also like to know how to get the border style. I just want to return the value to a variable for later comparison. Also I would need to know what to Dim the return variable as.

    For example in cell A1 the color 1 is red, color 2 is white, shading style is Vertical and Variant is left side color 1, right side color 2. Border style is xlDashDot. How could I return these properties to variables?

    Any help or clarification is appreciated. Thank you.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: How do I return to a variable the cell's fill effects and border properties?

    The code below is just a sample to give you some idea. There are too many attributes. You could record a macro and change just the ones you are interested in to see the results in code.

    Please Login or Register  to view this content.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    01-20-2011
    Location
    Richmond, VA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: How do I return to a variable the cell's fill effects and border properties?

    Thank you for the code. I can use this format to find border properties with Selection. Borders(xlEdgeLeft) and brdrvariable = .LineStyle. However, finding the two interior colors has proven more elusive. It appears as though Selection. Interior and getting .Pattern will return "4000" if there is a gradient. Getting both colors and the variant is more difficult (though .Gradient.Degree gives me some more clarification).

    If anyone can provide further clarification on getting the two inner colors used to create a fill gradient and shading style, I would be much obliged. Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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