Home |
Search |
Today's Posts |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Inputbox() Sum() MsgBox()
Just a couple of thoughts,
Declare AreaSum as Double not Long for decimals Wrap the SUM in error handling, in case On Error Resume Next AreaSum = WorksheetFunction.Sum(AreaClick) On Error GoTo 0 If Err.Number < 0 Then Msgbox "Problem with range" End If -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Nigel" wrote in message ... Try this modification........ Sub DumbAss_Click() Dim AreaClick As Range Dim AreaSum As Long Windows("how spent 73104rev").Activate Sheets("ITA").Select Set AreaClick = Application.InputBox(prompt:="Please click on area to sum", Title:="Auto Sum", Type:=8) AreaSum = WorksheetFunction.Sum(AreaClick) MsgBox (AreaSum) End Sub Cheers Nigel "Dim DumbAss as Name" <Dim DumbAss as wrote in message ... Can anyone help me? I am simply trying to have a range inputbox and then have the sum of that range pop up in a message box. This is what I have. Do I need a (for each cell in range statement)? If so how do I set that up? Any help thanks in advance. Private Sub DumbAss_Click() Dim AreaClick As Range Dim AreaSum As String Windows("how spent 73104rev").Activate Sheets("ITA ").Select Set AreaClick = Application.InputBox(prompt:="Please click on area to sum", Title:="Auto Sum", Type:=8) Set AreaSum = WorksheetFunction.Sum(AreaClick) MsgBox (AreaSum) End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help with InputBox and MsgBox | Excel Discussion (Misc queries) | |||
Help with InputBox and MsgBox | New Users to Excel | |||
msgbox / inputbox etc | Excel Discussion (Misc queries) | |||
msgbox / inputbox etc | Excel Worksheet Functions | |||
msgbox / inputbox etc | Setting up and Configuration of Excel |