View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Living the Dream Living the Dream is offline
external usenet poster
 
Posts: 151
Default Help with removing Time from Date

Hi Team

I am struggling to wrap my head around this.

I have a sheet that get populated via data off a clipboard( exported from Sapphire DB.

Does anyone have a handy snippet that will look at the range and detect what it is then do stuff:

I tried using this:

..Numberformat = "dd/mm/yy"
..Value = DateValue(.Value)

But it halts on the second part.

I then tried this ( and strangely enough, it worked once ).

With c
.. Formula = LEFT(.offset(,-1), Worksheetfunction.Find(".",.offset(,-1),-1))
End with

When I ran it again it kept throwing up a "Find" execution error.

Kind of hoping for something like:

IF IsDate(Range("A2:A100") Then
"Do something to trim off Time"
ELSE
IF IsText(Range("A2:A100") Then
"Do something else to trim off Time"
End If
End If

As always
TIA

Cheers
Mark.