View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
Judi Judi is offline
external usenet poster
 
Posts: 54
Default Doing MS Training in Excel, having Macro Issue

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