In Excel I want to change a date and time value received in Ireland format to the format used in India.
I tried this:
but I get a
suppose your Irish time
(14/09/2016 13:51:38) is in
then your Indian time:
with of course the time difference being 5 hours 30 minutes in this example
As you were looking for a VBA solution, I would use DateAdd here:
DateAdd("n", -330, "14/09/2016 13:51:38") in my example below I defined date ranges as I prefer to work that way, you could easily mould this into a loop.
Private Sub test() Dim irTime, inTime As Date irTime = Sheets(5).Cells(1, 1).Value inTime = DateAdd("n", -330, irTime) Sheets(5).Cells(1, 3).Value = inTime End Sub
If you are still getting
#Value errors I would look at the formatting of your Irish times and make sure taht they are all consitant and correctly formatted (don't forget to back-up incase you lose data playing around with formats).
This is my go-to bookmark for DateAdd as I always forget the
"n" interval for minutes, you might find it useful.