+ Reply to Thread
Results 1 to 9 of 9

VBA Conditional Formatting using wildcard

  1. #1
    Registered User
    Join Date
    03-25-2012
    Location
    Melbourne, Victoria
    MS-Off Ver
    Excel 2007
    Posts
    82

    VBA Conditional Formatting using wildcard

    Please Login or Register  to view this content.
    Can I use a Wildcard in "Special* so it finds any cells that have the word Special eg. Special Item, Special Deal, Special Sale

    Thanks In Advanced

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA Conditional Formatting using wildcard

    Hi,

    Not as far as I'm aware.

    I'd be inclined to use an initiial IF test. i.e.

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: VBA Conditional Formatting using wildcard

    Hi,

    This should work...

    Please Login or Register  to view this content.
    If you are not keen on using the "calculative" way in the Case statement, I think the only other way is to replace the Select case with an If...ElseIf...End If structure and use the condition similar to:

    Please Login or Register  to view this content.
    Regards,
    Rudi

  4. #4
    Registered User
    Join Date
    03-25-2012
    Location
    Melbourne, Victoria
    MS-Off Ver
    Excel 2007
    Posts
    82

    Re: VBA Conditional Formatting using wildcard

    Thankyou so much for all your help. Works like a dream but a little slow could you give any pointers of how to make it go faster.

  5. #5
    Registered User
    Join Date
    03-25-2012
    Location
    Melbourne, Victoria
    MS-Off Ver
    Excel 2007
    Posts
    82

    Re: VBA Conditional Formatting using wildcard

    Please Login or Register  to view this content.

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA Conditional Formatting using wildcard

    Quote Originally Posted by slohman View Post
    Thankyou so much for all your help. Works like a dream but a little slow could you give any pointers of how to make it go faster.
    Hi,

    Given that you have Excel 2007 and 64 levels of conditional format why are you using VBA anyway. VBA is generally always slower than normal Excel functionality so why not use cond. formats?

  7. #7
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: VBA Conditional Formatting using wildcard

    I second Richards reply.
    My initial response to your question was to help with the wildcard search, but based on the code you posted and the extra search and formatting you are doing, I'd tend to go the conditional formatting route. Its very flexible, easy to modify and will by fast and dynamic on the sheet. It's worth considering and experimenting with it. I'm not sure if there is much else we can do to the code to speed it up further.

    Maybe I can ask: Is it necessary to scan every cell in the range P5:BS700? Do these terms occur in ANY cell in this range or is it only specific columns. If we can minimize the amount of cells it must scan, it can significantly increase the speed.

  8. #8
    Registered User
    Join Date
    03-25-2012
    Location
    Melbourne, Victoria
    MS-Off Ver
    Excel 2007
    Posts
    82

    Re: VBA Conditional Formatting using wildcard

    Thanks for your suggestion. I am using the vba macro as I am inserting rows from another to this worksheet on a daily basis and I started using CF but it seems to mess up when I start moving rows around.

    I might have another look at CF if you both suggest it will make my worksheet run faster.

  9. #9
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: VBA Conditional Formatting using wildcard

    If you are bringing in data from another sheet or workbook, you could also experiment with the following to avoid issues with CF:

    Scenario 1: New data between existing data...
    Insert new cells or rows between the existing data that has CF (the data you copied will be pasted into these new cells/rows)
    Paste (as values) the copied data into these new cells, so that it does not overwrite the CF in the existing cells.
    The CF should kick in straight away since the CF is applied to cells/rows inserted between existing formatting.

    Scenario 2: New data below existing data...
    Paste the new copied data below the existing rows that have CF
    Activate the CF dialog and adjust the range to include the new added data. (See image below)

    1.jpg
    Last edited by RudiS; 04-23-2014 at 12:53 AM.

+ 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. [SOLVED] Cannot get Conditional Formatting formula to work with wildcard characters.
    By Oscar Martin in forum Excel General
    Replies: 4
    Last Post: 01-19-2014, 12:52 PM
  2. Replies: 1
    Last Post: 08-24-2012, 02:36 PM
  3. [SOLVED] problem with using asterisk as wildcard in conditional formatting
    By nsterng1 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-30-2012, 01:34 PM
  4. [SOLVED] Conditional Formatting with a Wildcard
    By Orestees in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-26-2012, 10:21 AM
  5. Wildcard In Condtional Formatting.
    By Big Rick in forum Excel General
    Replies: 3
    Last Post: 10-05-2005, 12:05 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