Macro Help!!!

  • Thread starter Thread starter mschmidt
  • Start date Start date
M

mschmidt

Forgive me for the double post. I had posted this question earlier in
the general excel usegroup, then saw there was programming group and
thought it belonged in here?

I'm trying to create a macro that will execute the funcyion below on a
three columns of data (C, E,F). The columns can vary in length from 26
to 60+ entries.

How do go about doing this?


=IF(E2=0,"? RT = "&TEXT(F2,"###.00"),C2)


Any help is very much appreciated.
 
Sub tester()
Dim vResult As Variant
vResult = IIf(Range("E2") = 0, _
"? RT = " & Format(Range("F2"), "###.00"), _
Range("C2").Value)
End Sub

HTH
 
sub tester
Var vResult as Variant
vResult = Iif(Range("E2")=0, _
"? RT = " & format(F2,"###.00"), _
Range("C2").Value
end sub
 
thanks, but I can't get to work. I saved the routine below and execute
tester as a macro and nothing happens?
I'm sure I'm doing something wrong.
any ideas??
 
I tried that and get a "Compile Error, Syntax Error"

Any way I could e-mail you my Spreadsheet?
 
Sub tester()
Dim vResult As Variant
vResult = IIf(Range("E2") = 0, _
"? RT = " & Format(Range("F2"), "###.00"), _
Range("C2").Value)
MsgBox vResult
End Sub

It's up to you to code whatever you want with vResult variable!
I just added a Msgbox that displays the value of the variable

Cheers,
--
AP


<[email protected]> a écrit dans le message de (e-mail address removed)...
thanks, but I can't get to work. I saved the routine below and execute
tester as a macro and nothing happens?
I'm sure I'm doing something wrong.
any ideas??
 
Yes please post it to (e-mail address removed)

HTH
--
AP

<[email protected]> a écrit dans le message de (e-mail address removed)...
I tried that and get a "Compile Error, Syntax Error"

Any way I could e-mail you my Spreadsheet?
 

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

Back
Top