Excel Visual Basic Question

Status
Not open for further replies.

campitel

Ars Praetorian
402
Subscriptor
Howdy,

I am trying to write a macro in excel that shades any cell that contains one or more asterisks in it. I know that the delimiteing character for wildcards is a tilde "~". My cells may contain, numbers, text, asterisks, or a combination of the three. If it's got an asterisk, I'd like the cell to be gray. I included my code below. Any help would be most appreciated. Thanks.

Code:
Sub shadeEQuISExceed()
    Dim data
    Dim standardColumn
    
    Set data = Application.InputBox(prompt:="Select data range", Type:=8)
        

    For Each datum In data
        rownumber = datum.Row
        colnumber = datum.Column

            
'I need help around here
            
            If datum Like "*~**" Then
                
                
                    With datum.Interior
                        .ColorIndex = 15
                        .Pattern = xlSolid
                        .PatternColorIndex = xlAutomatic
                    End With
                
                
            End If
    Next datum

End Sub
 
Status
Not open for further replies.