Hello,
I'm trying to sum a range of values selected by a user via a type 8 input box and set it as a variable for later evaluation. Can somebody please help? Thank you, find the vba below:
Sub formulacheck2()
Dim Y As String
Dim X As String
Dim R As Range
Dim ws As Worksheet
Dim N As Long
Dim B As Long
On Error Resume Next
Application.DisplayAlerts = False
Set R = Application.InputBox(Prompt:= _
"Please select the range the formula check is contained in.", _
Title:="SPECIFY RANGE", Type:=8)
On Error GoTo 0
Application.DisplayAlerts = True
If R Is Nothing Then
Exit Sub
Else
N = Application.WorksheetFunction.Sum(R)
I'm trying to sum a range of values selected by a user via a type 8 input box and set it as a variable for later evaluation. Can somebody please help? Thank you, find the vba below:
Sub formulacheck2()
Dim Y As String
Dim X As String
Dim R As Range
Dim ws As Worksheet
Dim N As Long
Dim B As Long
On Error Resume Next
Application.DisplayAlerts = False
Set R = Application.InputBox(Prompt:= _
"Please select the range the formula check is contained in.", _
Title:="SPECIFY RANGE", Type:=8)
On Error GoTo 0
Application.DisplayAlerts = True
If R Is Nothing Then
Exit Sub
Else
N = Application.WorksheetFunction.Sum(R)