wild card - cash deposit

G

Guest

Sub insert()
Dim r As Range
Dim rd As Range
Set r = Range("H2")
Do While Not IsEmpty(r)
Set rd = r.Offset(1, 0)
If r.Offset(0, -1) = "Cash Deposits*" Then
r.insert Shift:=xlToRight
End If
Set r = rd
Loop
End Sub

Above macro is not working on e.gCells containing Cash Deposits Euro100 or
Cash Deposits USD 1000
Can someone pls correct my macro thxs
 
G

Guest

You might have to use the Like operator.

If r.Offset(0, -1) Like "Cash Deposits*" Then
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top