Need to change the following code

P

pgarcia

Hello all,
I have this bit of code and I need to add the following fomula instead of
the VB code. Thanks

I need this part changed:
r1.PasteSpecial Paste:=xlValues, Operation:=xlMultiply, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False

To some thing like this: =ROUND(ROUND(A1,2)*1.09,2)

End With

Range("R:S").ClearContents

Range("R13").Select
ActiveCell.FormulaR1C1 = "COUNTRY"
Range("R14").Select
ActiveCell.FormulaR1C1 = " New Zealand"
Range("R15").Select
ActiveCell.FormulaR1C1 = "Australia"
Range("S13").Select
ActiveCell.FormulaR1C1 = "1.9"

Range("A13:p550").AdvancedFilter _
Action:=xlFilterInPlace, _
CriteriaRange:=Range("R13:R15"), _
Unique:=False

Set r = Range("H13:p500")
Set r = r.Offset(1, 0).Resize(r.Rows.Count - 1)

On Error Resume Next
Set r1 = r.SpecialCells(xlVisible)
On Error GoTo 0
If Not r1 Is Nothing Then
Range("S13").Copy
r1.PasteSpecial Paste:=xlValues, Operation:=xlMultiply, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End If
 
B

Bernie Deitrick

pgarcia,

Change

If Not r1 Is Nothing Then
Range("S13").Copy
r1.PasteSpecial Paste:=xlValues, Operation:=xlMultiply, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End If

to, for example:

If Not r1 Is Nothing Then
r1.Formula = "=ROUND(ROUND($A" & R1.Cells(1,1).Row & ",2)*1.09,2)"
End If

If you want each formula to refer to column A of its own row....

HTH,
Bernie
MS Excel MVP
 

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