Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
UseFunction question
watch the typo
Dim ans was Long should be Dim ans as Long -- Regards, Tom Ogilvy "bumper338" wrote in message ... Thanks Tom, That is what I was looking for. Tj Also, Thanks Alok and John. "Tom Ogilvy" wrote: Sub UseFunction() Dim myRange As Range Dim answer Dim ans was Long Set myRange = Worksheets("Sheet1").Range("A1:C10") answer = Application.WorksheetFunction.Sum(myRange) If answer 3 Then ans = MsgBox("You have " & _ answer & " hours", vbYesNo + _ vbQuestion, "Test") if ans = vbYes then Worksheets("Sheet1").Range("C12").Value = _ answer end if End If End Sub -- Regards, Tom Ogilvy "bumper338" wrote: I am using the following: Sub UseFunction() Dim myRange As Range Set myRange = Worksheets("Sheet1").Range("A1:C10") answer = Application.WorksheetFunction.Sum(myRange) If answer 3 Then answer = MsgBox("You have " & [answer] & " hours", vbYesNo + vbQuestion, "Test") End If End Sub What I would like to do, is when the user clicks on the Yes button, it puts the answer in an open cell. How would I do that? Thanks in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|