On Mon, 6 Jul 2009 06:51:32 -0700 (PDT), Curious
wrote:
I have three sheets in the Excel, by default, they're called Sheet1,
Sheet2, and Sheet3.
I renamed the sheets to "MarketData", "LongTermLimits", and
"ShortTermLimits" respectively.
I want to create a VB (macro?) inside an Excel file as below:
Sub MatchShortTermLimits()
Sheet2.UsedRange.Rows.Count
End Sub
It gives me an error, "Compile error: Invalid use of property"
I changed the code to:
Sub MatchShortTermLimits()
LongTermLimits.UsedRange.Rows.Count
End Sub
It then complains "Object required"
Any advice on how to get this fixed? I only want to get the row count
of Sheet2 (renamed to "LongTermLimits").
Try this:
Sub MatchShortTermLimits()
Worksheets("LongTermLimits").UsedRange.Rows.Count
End Sub
Hope this helps / Lars-Åke