Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Help with removing Time from Date

Hi Mark,

Am Thu, 5 Oct 2017 05:20:22 -0700 (PDT) schrieb Living the Dream:

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:


did you try Data = Text to column = Delimited = Delimter is comma
In step 3 choose for second column "Do not import column"

If that doesn't work try:

Sub DateTime()
Dim rngC As Range
For Each rngC In Range("A2:A100")
rngC = Int(rngC)
Next
Range("A2:A100").NumberFormat = "dd/MM/yy"
End Sub

If that also doesn't work provide a workbook with the data in column A
that we can look for the format and how to solve the problem.


Regards
Claus B.
--
Windows10
Office 2016
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 151
Default Help with removing Time from Date

Hi Claus. As always, you are a legend. Worked a treat.

Thank you heaps.

Cheers
Mark.
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
Converting text format of time/date into Excel time/date for subtr YY san.[_2_] Excel Worksheet Functions 6 February 25th 10 08:27 AM
removing/ignoring time in a date time field Jeff Excel Discussion (Misc queries) 2 July 18th 08 07:35 PM
Removing date from time Ugnz Excel Discussion (Misc queries) 5 November 13th 07 10:00 PM
Calculating days & time left from start date/time to end date/time marie Excel Worksheet Functions 7 December 7th 05 02:36 PM
Combined date time cell to separate date & time components Mark Ada Excel Worksheet Functions 1 December 2nd 04 12:04 AM


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