ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Problem using Day() in a macro (https://www.excelbanter.com/excel-worksheet-functions/169756-problem-using-day-macro.html)

Marie

Problem using Day() in a macro
 
I am trying to use the Day() function in a macro using a line like this

intLastDay = Application.WorksheetFunction.Day(date as a serial)

But VBA does not seem to recognize Day() as a worksheetFunction
Anybody has an idea why?

PS I am using Excel 2007
--
Marie

Dave Peterson

Problem using Day() in a macro
 
Because VBA has its own Day() function.

intlastday = day(mydate)



Marie wrote:

I am trying to use the Day() function in a macro using a line like this

intLastDay = Application.WorksheetFunction.Day(date as a serial)

But VBA does not seem to recognize Day() as a worksheetFunction
Anybody has an idea why?

PS I am using Excel 2007
--
Marie


--

Dave Peterson

Mike H

Problem using Day() in a macro
 
Hi,

You don't need to use the Day() worksheetfunction because VB has its own
day() function.

MyDay = Day(MyDate)

Mike

"Marie" wrote:

I am trying to use the Day() function in a macro using a line like this

intLastDay = Application.WorksheetFunction.Day(date as a serial)

But VBA does not seem to recognize Day() as a worksheetFunction
Anybody has an idea why?

PS I am using Excel 2007
--
Marie



All times are GMT +1. The time now is 07:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com