ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Identifying Date Cells (https://www.excelbanter.com/excel-programming/291550-identifying-date-cells.html)

SuperJas

Identifying Date Cells
 
Hi

Is there a simple piece of code that can identify whether a cell is formatted as a date? I'd like to identify such cells in my worksheet and tell the macro to skip over these when processing

Many thanks in advance

SuperJas.

acw[_2_]

Identifying Date Cells
 
SuperJa

Have a look at the CELL function. In the form CELL("format",a1) it will return a series of values in the range D1 - D9 for date formats

Ton

----- SuperJas wrote: ----

Hi

Is there a simple piece of code that can identify whether a cell is formatted as a date? I'd like to identify such cells in my worksheet and tell the macro to skip over these when processing

Many thanks in advance

SuperJas.

John Wilson

Identifying Date Cells
 
SuperJas,

Try the isdate function

From the immediate window:

?isdate(range("B10"))

Sub TestMe()
If isdate(range("B10") then
msgbox "It's a date"
else
msgbox "Not a date"
End If
End Sub

John




"SuperJas" wrote in message
...
Hi,

Is there a simple piece of code that can identify whether a cell is

formatted as a date? I'd like to identify such cells in my worksheet and
tell the macro to skip over these when processing.

Many thanks in advance,

SuperJas.





All times are GMT +1. The time now is 10:37 PM.

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