Hello,
I have macro with Subtotal function
1)run macro
2) select cell for subtotal
3) Select type of subtotal
4 ) Select area for subtotal
5) in selected cell from phase 2) should be imported subtotal, but shows error in row ActiveCell.Formula .... , pls help me correct the macro:
Thank you
I have macro with Subtotal function
1)run macro
2) select cell for subtotal
3) Select type of subtotal
4 ) Select area for subtotal
5) in selected cell from phase 2) should be imported subtotal, but shows error in row ActiveCell.Formula .... , pls help me correct the macro:
Code:
Sub SUBTOTAL_V2()
'NEfunguje
Dim myValue As Range
Dim myType As Variant
Dim rng As Range
Set myValue = Application.InputBox("Cell to put SUBTOTAL", Type:=8)
myType = InputBox("Type of subtotal:" & vbCrLf & _
"1 - AVERAGE" & vbCrLf & _
"2 - COUNT" & vbCrLf & _
"3 - COUNTA" & vbCrLf & _
"4 - MAX" & vbCrLf & _
"5 - MIN" & vbCrLf & _
"9 - SUM" & vbCrLf & _
"For ignoring hidden values put before 10, for example 101, 102 etc.", "GleedsTool", "9")
Set rng = Application.InputBox("Area", Type:=8)
myValue.Select
ActiveCell.Formula = "=subtotal(" & myValuee & "," & rng & ")"
End Sub
Thank you