View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Reference to a workbook / amount of days

Dim dt as Date
Dim days as Long
dt = Workbooks("abc.xls").Sheets("abc").Range("R20").Va lue
days = Day(DateSerial(Year(dt), Month(dt)+1, 0))

--
Regards,
Tom Ogilvy


"Mirja" wrote in message
...
Hello!
I need to find out the amount of days in a month with VBA.
The command needs to be linked with a sheet in another
workbook. If the cell within the sheet shows i.e.
February, than monthdays should be 28. So far I have the
following command which is used for the days of the
current month:

days = Day(DateSerial(Year(Date), Month(Date)+1, 0))

How can I change it? Can I refer to another workbook and
sheet for example the following:(workbooks
("abc.xls").Sheets("abc").Range("R20"))?

Thx, Mirja