+ Reply to Thread
Results 1 to 8 of 8

Macro to apply a pattern to a cell

  1. #1
    Registered User
    Join Date
    11-20-2013
    Location
    London, Ontario, Canada
    MS-Off Ver
    Excel 2010
    Posts
    4

    Macro to apply a pattern to a cell

    Hi everyone,
    Yes, I'm somewhat new to macros. Unless I can just record them and go I'm not much use. Which brings me to this; is there a way to record a macro to add a pattern to a cell without changing that cells color?

    No matter what I try, the macro to pattern the cell always changes its color to white. I have three colors I use in my spreadsheet and just want a pattern to show task completed.

    Thank you.

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Macro to apply a pattern to a cell

    Can you upload a workbook with before and after example?

    I'm having a hard time understanding the "pattern" you're looking for.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Registered User
    Join Date
    11-20-2013
    Location
    London, Ontario, Canada
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Macro to apply a pattern to a cell

    Thank you. Basically all I want to do is the same as when you right click, format cells, go to the Fill tab and select a pattern style.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to apply a pattern to a cell

    I'm guessing you recorded, which would give you code like this.

    Please Login or Register  to view this content.
    You have to edit out the first line of the With

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-20-2013
    Location
    London, Ontario, Canada
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Macro to apply a pattern to a cell

    Thanks John. I'll try that! Here's what I have right now:

    Sub Slash()
    '
    ' Slash Macro
    '
    ' Keyboard Shortcut: Ctrl+s
    '
    With Selection.Interior
    .Pattern = xlLightDown
    .PatternColorIndex = xlAutomatic
    .ColorIndex = xlAutomatic
    .TintAndShade = 0
    .PatternTintAndShade = 0
    End With
    End Sub

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to apply a pattern to a cell

    Then delete this

    Please Login or Register  to view this content.
    Or it will change the interiorcolor from what it was.

  7. #7
    Registered User
    Join Date
    11-20-2013
    Location
    London, Ontario, Canada
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Macro to apply a pattern to a cell

    Worked beautifully!! Thank you so very much John.

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to apply a pattern to a cell

    You're welcome. Glad to help out, and thanks for the feedback. Please comply with Forum Rule No. 9.

    9. Acknowledge the responses you receive, good or bad. If your problem is solved, please say so clearly, and mark your thread as Solved: Click Thread Tools above your first post, select "Mark your thread as Solved". Or click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Dropdown option or Edit button will not appear -- ask a moderator to mark it.

+ 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. Replies: 8
    Last Post: 05-16-2019, 10:09 AM
  2. Macro for pattern matching a string in a cell
    By gravel in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-30-2011, 05:33 PM
  3. How to apply Macro to a cell?
    By Twaddy in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 08-02-2008, 05:59 PM
  4. Apply two conditions in one cell within a macro
    By critmark in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-17-2007, 01:51 PM
  5. How to apply a macro to a protected cell
    By greensl in forum Excel General
    Replies: 1
    Last Post: 08-03-2005, 12:05 PM

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