View Single Post
  #13   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

Thank you, I will look into this too. I just started learning Access a month
ago and now I'm delving deeper into VBA and seeing how it can be used in
other programs too.

I'm very interested in this, and I am thinking about perhaps taking some
classes to learn more.

Thanks again, I always get good advice here.

"Dave Peterson" wrote:

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