Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How do I check if a cell is formatted as a date in Excel VB?

I'm using MS Office Excel 2007; trying to write VB function to update a cell
content with a date; would like to first determine if that cell already has
been formatted as a date; otherwise do not update
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How do I check if a cell is formatted as a date in Excel VB?

Alex,

This statement checks if the format contains a day in the format for cell
A1:

If InStr(Range("A1").NumberFormat, "d") 0 Then
' Cell is formatted as a date
End If

Greetz, Gertjan

Alex@LM wrote...
I'm using MS Office Excel 2007; trying to write VB function to update a
cell
content with a date; would like to first determine if that cell already
has
been formatted as a date; otherwise do not update



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How do I check if a cell is formatted as a date in Excel VB?

Thank you, Gertjan. This is just what I needed!

"Gertjan Huiskes" wrote:

Alex,

This statement checks if the format contains a day in the format for cell
A1:

If InStr(Range("A1").NumberFormat, "d") 0 Then
' Cell is formatted as a date
End If

Greetz, Gertjan

Alex@LM wrote...
I'm using MS Office Excel 2007; trying to write VB function to update a
cell
content with a date; would like to first determine if that cell already
has
been formatted as a date; otherwise do not update




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
cell formatted as date won't change NEHicks Excel Discussion (Misc queries) 5 March 14th 21 12:52 PM
Extracting date from Date and Time formatted cell Aviral Sharma Excel Discussion (Misc queries) 2 March 6th 09 06:04 AM
When using & and a date-formatted cell in a formula I lose the for Jeff Stouse Excel Worksheet Functions 2 December 5th 07 09:47 PM
how do i add 1 year to a date formatted cell? rogerm Excel Worksheet Functions 5 September 4th 05 06:46 AM
Converting 'General' formatted cells to Text formatted cell using. Zahid Khan Excel Worksheet Functions 1 March 12th 05 08:13 PM


All times are GMT +1. The time now is 11:03 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"