I have a spreadsheet, where I would like to set a variable equal to the number of rows in a range, because I would like to use that number in offset formulas. I defined the variable like this: Dim TotalRows As Long. Then I tried to set it as follows: Set TotalRows = Range(Selection, Selection.End(xlDown)).Count. When I Debug my code, it highlights this row and says "object required". I tested this code in a message box, and it gives me the number that I want. Why does it say "object required"? What do I need to do to correct this?