Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sum amount of days in another coloumn | Excel Worksheet Functions | |||
Calculating unearned amount billed 45 days in advance... | New Users to Excel | |||
Calculate Count of Days & Average WHERE Amount <0 | Excel Worksheet Functions | |||
set a warning in excel after a certain amount of days | Excel Discussion (Misc queries) | |||
amount of working days per month | Excel Discussion (Misc queries) |