View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
[email protected] aidan.heritage@virgin.net is offline
external usenet poster
 
Posts: 244
Default Type mismatch problem

Cells requires the row/col co-ordinates - see the examples above, range
will allow a text string
Dan wrote:
When I use

StartDate = Sheets("Macro Data").Range("B1").Value

it works. If I use

StartDate = Sheets("Macro Data").Cells("B1").Value

I get the type mismatch error. This is my first attempt to use macros in
Excel. What is the difference between Range and Cells?

Dan


" wrote:

You can also do sheets("Macro Data").range("A2")
wrote:
wrote:

Sorry, The previous has some wrong,

The correct is
StartDate = Sheets("Macro Data").Cells(1,2)


Aheng
MSN: