View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Pam[_3_] Pam[_3_] is offline
external usenet poster
 
Posts: 56
Default if, then, replace text

Wow! That was quick and perfect!
Thanks so much for your help.

"Rick Rothstein" wrote in message
...
Give this macro a try (change my Sheet1 reference in the With statement to
your worksheet's actual name)...

Sub FindCCCopyMarginToMerch()
Dim C As Range
Dim FirstAddress As String
With Worksheets("Sheet1")
Set C = .Columns("P").Find("CC", LookIn:=xlValues, _
LookAt:=xlWhole, MatchCase:=False)
If Not C Is Nothing Then
FirstAddress = C.Address
Do
.Cells(C.Row, "I").Value = .Cells(C.Row, "K").Value
Set C = .Columns("P").FindNext(C)
Loop While Not C Is Nothing And C.Address < FirstAddress
End If
End With
End Sub

--
Rick (MVP - Excel)


"Pam" wrote in message
...
Hi,

I have a worksheet with columns "Merch" (Column I), "Margin" (Column K)
and "Terms" (Column P). What I want to do is, if Terms = CC, replace
Merch $ amount with Margin $ amount? Is this possible with code?

Any help would be greatly appreciated.
Thanks in advance,
Pam