Hi all
I am just starting out writing Macros with VBA and I have hit a brick wall with my first little project.
My aim is to develop a procedure to autosum a range in a worksheet with a variable number of rows each time i work with this type of worksheet (a file exported from a financial program)
I know that the range will always start in H9.
I had hoped this would do the trick, but I get the error message: method range of object _global failed.
Here is my code:
I will be gratefull for any help in the matter.Sub SalesTotal()
Dim Sales As Long
Sheets("SalesSheet").Activate
Range("H9").Select
Sales = Range(Selection, Selection.End(xlDown)).Select
TotalSales = WorksheetFunction.Sum(Range("Sales"))
End Sub
Cheers
GröFaz
Bookmarks