• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to adjust macro code to accept further data?

Eloise T

Active Member
Below is a line of VBA that looks for "** Received check **" or "Received cash **"
I need to modify it so that if there's anything beyond the 4th asterisk, the "OR" will find the expression True.
In other words, as long as the data begins with either "** Received check **" or "Received cash **" then let the expression be True.

Thank you for looking.

.FormatConditions.Add Type:=xlExpression, Formula1:="=OR($D3=""** Received check **"",$D3=""** Received cash **"")"



The whole deal is:
Code:
'Column D ------------------------------------------------------------------------------------------
'** Received check ** / ** Received cash **

                With Ws.Range("D3:D8503")
             
                    .FormatConditions.Delete
                    .FormatConditions.Add Type:=xlExpression, Formula1:="=OR($D3=""** Received check **"",$D3=""** Received cash **"")"
                    .FormatConditions(.FormatConditions.Count).Font.Bold = False          'Bold font
                    .FormatConditions(.FormatConditions.Count).Font.ColorIndex = 1        'Black font
                    .FormatConditions(.FormatConditions.Count).Interior.ColorIndex = 2    'White background
                    .FormatConditions(.FormatConditions.Count).StopIfTrue = False
                 
                End With
[\CODE]
 
Last edited:
You can just add in a couple of LEFT functions - eg:

Code:
"=OR(LEFT($D3,20)=""** Received check **"",LEFT($D3,19)=""** Received cash **"")"
 
Back
Top