ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   create macro (https://www.excelbanter.com/excel-programming/273967-create-macro.html)

Todd[_5_]

create macro
 
Hi, I am trying to make a macro that looks into a range
of cells I select and adds to a forumla. I have worked
something up but it doesn't work. Can someone help?

Thanks,


Todd

I have:
=IF(Ds140,ROUND($E14*Ds14,0),"")

I want:
=IF(DS14="","",IF(DS140,ROUND($E14*DS14,0),""))

The macro I am working with is:
Sub ReplaceDataTEST()
Selection.Replace What:="IF(DR140", Replacement:="IF
(Ds14="","",IF(Ds140", LookAt:=xlPart
End Sub

Konrad[_2_]

create macro
 
pls try this, Konrad
questions welcowe
Sub test_23()
On Error GoTo konrad
Dim a
a = InputBox("Type your Formula. ", "Test with formulas by
Konrad", "=RC[1]+RC[2]", 350, 350)

Select Case a
Case Is < ""
Set myRange = Selection
MsgBox myRange.Cells.Count
For i = 1 To myRange.Cells.Count
myRange.Cells(i).Formula = a '###########your formula
Next i
Case ""
MsgBox "pls type your formula"
konrad:
MsgBox "Sorry an error occured, pls chack your formula."
End Select

End Sub

-----Original Message-----
Hi, I am trying to make a macro that looks into a range
of cells I select and adds to a forumla. I have worked
something up but it doesn't work. Can someone help?

Thanks,


Todd

I have:
=IF(Ds140,ROUND($E14*Ds14,0),"")

I want:
=IF(DS14="","",IF(DS140,ROUND($E14*DS14,0),"") )

The macro I am working with is:
Sub ReplaceDataTEST()
Selection.Replace What:="IF(DR140", Replacement:="IF
(Ds14="","",IF(Ds140", LookAt:=xlPart
End Sub
.



All times are GMT +1. The time now is 11:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com