Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default VBA: Reference to a workbook / amount of days

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sum amount of days in another coloumn Scott_goddard Excel Worksheet Functions 8 April 13th 10 12:51 PM
Calculating unearned amount billed 45 days in advance... HeatherK New Users to Excel 1 July 30th 08 04:31 PM
Calculate Count of Days & Average WHERE Amount <0 amg0657 Excel Worksheet Functions 1 April 1st 08 02:37 AM
set a warning in excel after a certain amount of days George Excel Discussion (Misc queries) 3 August 29th 06 01:05 AM
amount of working days per month Nigel Excel Discussion (Misc queries) 2 November 29th 05 10:41 AM


All times are GMT +1. The time now is 09:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"