This is not your answer, but maybe you can playing around with the code
Sub test1()
Set userResponce = Application.InputBox("Please select the cell where you want the Total to appear", _
Title:="Select the cell for your Total", Type:=8)
oSum = 0
For i = 1 To 8
oAdd = Application.InputBox("Click on first cell to be totalled")
If oAdd <> "" Then oSum = oSum + oAdd
Next i
ActiveSheet.UnProtect
userResponce.Value = oSum
ActiveSheet.Protect
End Sub
The code above will add whether the user select the cell then click OK
or the user does not select the cell then click OK or click Cancel.
After 8 iteration, the sum value will be put to whatever cell the user select on userResponce
Sub test2()
ActiveSheet.UnProtect
Set userResponce = Application.InputBox("Please select the cell where you want the Total to appear", _
Title:="Select the cell for your Total", Type:=8)
userResponce.Value = 0
For i = 1 To 8
oAdd = Application.InputBox("Click the cell to be totalled")
If oAdd <> "" Then userResponce.Value = userResponce.Value + oAdd
Next i
ActiveSheet.Protect
End Sub
The code above will show the addition value into whatever cell the user select on userResponce
That's for your number-1.
For number-2, it's not clear to me how you define the sheet name as variable.
As long as I know, the sheet must active first (or must be activated first) - then you can select the range.
' Would like to use
Range Name "TargetSheet"...but does not work.......COMPILE ERROR - SUB OR FUNCTION NOT DEFINED
'
Sheet(TargetSheet).Activate '*****THIS LINE CAUSES THE ERROR
As long as I know, we cannot
activate a sheet with a code like blue.
What I do is select/activate the sheet first, then activate the named range :
Sheets("other").Activate
Range("TargetSheet").Activate
Sheet1.Activate 'don't want to keep this line as it is static
I wonder how you define the sheet name into variable.
Bookmarks