Function Macro

S

Suzie

Hi - I have to do an assignment which involves writing a function macro.
This is what I have written:

Sub Review()
Function Review(Overall As Single, recent As Single) As String
If recent >= 4 Then
Good&
Else
Poor&
End If
If recent >= Overall Then
Improving&
Else
Interview&
End If
Review = recent & Overall
Range("E8").Select

End Function
End Sub

Now I don't know much about vba and I'm having trouble making this work.
Would some kind person out there be able to explain to me where I am going
wrong? The message that I keep getting is that Review is too ambiguous !!

I would very much appreciated any help at all.
Thank you
Suzie
 
J

JulieD

Hi Suzie

couple of things .. although i'm actually not sure what you're trying to
achieve here
1) you've a function procedure embedded in a sub procedure
either ditch the function or the sub or use the sub to call the function
and pass the variables
2) text in vba procedures is the same as text in formulas you need to put it
in "" - so if you want to see the word good returned in a cell use "Good"
3) if you're refering to a range name (as i've really no idea what "recent"
refers to) you need to use
Range("recent")
4) you're not writing the results out anywhere do you want something like
Range("E8").value = review
5) you should really DIM your variables (and then we'ld know if they're
variables or text)

See how you go with the above and if you're still stuck please feel free to
post back with a few more details of what it is you're trying to achieve.

Regards
JulieD
 

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

Help with Function Macro 4
More help needed with a macro 1
Array macro question 4
Macro Question 2
Speek cells, barcode scanner 3
Using Drop Down Menu for Macro 6
Macro 9
Outlook Macro to set Reminder on a Contact tomorro 9:00 4

Top