When you have selected a range, it is sometimes useful to know how many rows or columns you have selected as this information can be used in your macros (for eg when you have reached the end, you will know it is time to stop the macros. This macro will do the trick.
Sub Count()
mycount = Selection.Rows.Count 'Change Rows to Columns to count columns
MsgBox mycount
End Sub
The next macro counts the number of sheets instead. Refer to Protecting all sheets macro which uses this method.
Sub Count2()
mycount = Application.Sheets.Count
MsgBox mycount
End Sub
Regards,
Praveen KVC
13 January 2010
Tuesday, January 12, 2010
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment