Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format function

Status
Not open for further replies.

eHanSolo

Technical User
May 24, 2004
260
GB
HI guys,

I'm trying to create a loop based on the contents of a column. the date format in my column (say A) is: dd/mm/yyyy

My code is something like:

MyDate = cells(1,"A")
DateFormat = Format(MyDate, "dd/mm/yyyy")

while cells(1, "A") = DateFormat
My code here
Wend


Can someone tell me where i'm going wrong?? :(

Many thanks!!!

E
 
What exactly is it you're trying to do? Why do you need a loop?

*cLFlaVA
----------------------------
Ham and Eggs walks into a bar and asks, "Can I have a beer please?"
The bartender replies, "I'm sorry, we don't serve breakfast.
 
I think you are getting the FORMAT function the wrong way round. Format APPLIES a format to an object or variable rather than being a property that RETURNS the format of the object / variable

If I understand correctly, you need to use
DateFormat = cells(1,"A").NUMBERFORMAT


Rgds, Geoff

Yesterday it worked. Today it is not working. Windows is like that.

Please read FAQ222-2244 before you ask a question
 
I basically have a few columns and i'm only interested in rows which have a very specific date format... the rest is in a different date format so i'm hoping to identify just these ones and manipulate their data.

I'm having trouble using 'IsDate'...



E
 
IsDate works perfect!!

Thanks you guys for all your help!!! Have a good weekend!

E
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top