Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Inputbox() Sum() MsgBox()

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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with InputBox and MsgBox Preschool Mike Excel Discussion (Misc queries) 9 April 14th 10 06:23 PM
Help with InputBox and MsgBox Ann New Users to Excel 2 April 11th 07 03:46 PM
msgbox / inputbox etc samenvoegen van sheets Excel Discussion (Misc queries) 2 March 16th 06 08:56 AM
msgbox / inputbox etc samenvoegen van sheets Excel Worksheet Functions 2 March 15th 06 04:28 PM
msgbox / inputbox etc samenvoegen van sheets Setting up and Configuration of Excel 1 March 15th 06 03:32 PM


All times are GMT +1. The time now is 07:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"