View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Userrange to formula

Hi,

Am Wed, 10 Apr 2013 14:00:15 +0000 schrieb Klaasv:

Now I have this:
Sub Test()

Set UserRange = Application.InputBox("Hallo", "Select your range:")
Rng = Application.WorksheetFunction.Sum(UserRange)
Range("C1").Select
Selection.Value = Rng

End Sub


try:

Sub Test()
Dim UserRange As Range

Set UserRange = Application.InputBox("Hallo", _
"Select your range:", Type:=8)
If Not UserRange Is Nothing Then
[C1] = WorksheetFunction.Sum(UserRange)
End If

End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2