+ Reply to Thread
Results 1 to 9 of 9

VBA Pattern question

  1. #1
    Registered User
    Join Date
    10-16-2014
    Location
    Minnesota
    MS-Off Ver
    2013
    Posts
    11

    VBA Pattern question

    Hi I tried searching and couldn't find the right answer. I'm looking to create a vb macro code to fill a selected cell with a specific patter and pattern color, but I want it to keep whatever background color is in the selected cell the same.

    I have so far:
    Please Login or Register  to view this content.
    I tried messing with the .ColorIndex line and can get it to work but not without a runtime error.

    And if possible, upon running the macro a second time, removing the pattern and again keeping the background color the same.

    Any help would be greatly appreciated.
    Last edited by Leith Ross; 10-23-2014 at 01:29 PM. Reason: Added Code Tags

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: VBA Pattern question

    Welcome to the forum.

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    10-16-2014
    Location
    Minnesota
    MS-Off Ver
    2013
    Posts
    11

    Re: VBA Pattern question

    Thanks for the welcome and the code. would those be two separate macros? is there a way to write a code assign it to a button so that when I hit, lets just say Ctrl+a, it fills the pattern and then when I hit Ctrl+a again it removes the pattern?

  4. #4
    Registered User
    Join Date
    10-16-2014
    Location
    Minnesota
    MS-Off Ver
    2013
    Posts
    11

    Re: VBA Pattern question

    It would probably be easier if the else statement removed Any present pattern in the selected cell, which is fine/better.

  5. #5
    Registered User
    Join Date
    10-16-2014
    Location
    Minnesota
    MS-Off Ver
    2013
    Posts
    11

    Re: VBA Pattern question

    Haha kind of walked myself through that with your help:

    Please Login or Register  to view this content.
    Thank you so much!
    Last edited by zmoclov21; 10-23-2014 at 03:00 PM. Reason: Added Code Tags

  6. #6
    Registered User
    Join Date
    10-16-2014
    Location
    Minnesota
    MS-Off Ver
    2013
    Posts
    11

    Re: VBA Pattern question

    Is there a way to change the first argument of the If statement to read if there's any pattern in the selected cell at all?

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: VBA Pattern question

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    10-16-2014
    Location
    Minnesota
    MS-Off Ver
    2013
    Posts
    11

    Re: VBA Pattern question

    Oh Wow, Duh. Thanks Again for all your help.

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: VBA Pattern question

    You're welcome.

+ 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. Copy down hypertext cell range pattern & cell reference formula pattern
    By Underexcelling in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-10-2014, 03:23 AM
  2. creating the pattern C7,C14,C21...
    By slaygay in forum Excel General
    Replies: 15
    Last Post: 07-04-2009, 11:00 PM
  3. Number pattern
    By jillteresa in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-12-2009, 10:50 AM
  4. [SOLVED] Chequer-box Pattern
    By Stuart in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-06-2005, 11:07 PM

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