• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to trim IST from Date time

ahtesham06

New Member
Sorry for asking so simple question. I am very very new to vba

How i can write Vba so that IST could be removed from the data . e.g final result should look like 07/10/2019 08:53

61281
 
Something like below.
Code:
Sub Demo()
Dim strDate As String
Dim res
strDate = "07/10/2019 08:53:03 IST"
res = Replace(strDate, " IST", "")
res = CDate(res)
Debug.Print res
End Sub

If you need further help, I'd recommend that you upload sample workbook.
 
You could also do this with Power Query. Load the table to PQ. Split the column on the right most space. Delete the column you just created holding only the value IST. Load the table/query back to your excel sheet.
 
Back
Top