![]() |
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 |
All times are GMT +1. The time now is 03:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com