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

The first thing to do, in my opinion is to go to the help function in VB and search/browse
through it.

Another way - place your cursor on the item (Dim-for ex) and hit F1.
This should open up the help topic for this item.

Have fun.
--
Regards
Rob
"Judi<<" wrote in message
...
Thank you so much...

Is there a list that tell you what to define each thing as, or is this
something you just learn from experience?

Thanks again!!

"RobWN" wrote:

Judi;
As I noted, the declaration is the "Dim" statement.
The "As" portion tells Excel what the format is.
Try
Dim MyCell as Variant

--
Regards
Rob
"Judi<<" wrote in message
...
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