You could use:
Dim myCell as Variant
but in this case, it's much more natural to use:
Dim myCell as Range
You may want to consider a book (or two).
Debra Dalgleish has a list of books at her site:
http://www.contextures.com/xlbooks.html
John Walkenbach's books are very good to start.
Judi<< wrote:
Now I have this one. I defined z as long, but VBA is telling me that MyCell
needs to be defined too, how do you define a cell?
Thanks again,
Judi <<
Option Explicit
Sub CountCells()
Dim z As Long
z = 0
For Each MyCell In Selection
z = z + 1
Next
MsgBox "There are " & z & " cells in the selection."
End Sub
--
Dave Peterson