BewilderedSoul
New Member
- Joined
- Apr 22, 2011
- Messages
- 6
Hi, I'm running the following macro at home.xlsm. The msgbox will show me the value generated by the MySubtotal method. However, I want the results to be pasted to one of the cells in home.xlsm. Can it be done?
Code:
Sub total()
Dim MySelection As Range
Dim MySubtotal As Double
Windows("book1.xls").Activate
Set MySelection = Application.InputBox(Prompt:="Select a range of cells", Type:=8)
MySubtotal = Application.WorksheetFunction.Subtotal(9, Worksheets("Sheet1").Range(MySelection.Address))
Windows("home.xlsm").Activate
MsgBox MySubtotal
End Sub