Date formatting issue VB

L

Living the Dream

Hi everyone

In this particular sheet, I have columns that are already formatted to
"dd/mm/yyyy" and contain dates that actually display as such ( although,
these dates are wrong for my purpose).

I wrote this which works, but it keeps converting the cells to
international/US and it's giving me the (you know whats).

Sub ConvertDates()

Dim mySht1 As Worksheet, mySht2 As Worksheet
Dim myRng As Range, c As Range, WED As Range
Dim cDat As String

Set mySht1 = Sheets("TMS DATA")
Set myRng = mySht1.Range("$S$6:$U$300")

Set mySht2 = Sheets("SUPPORT DATA")
Set WED = mySht2.Range("$B$2")
'adds extra day(s) as the date needs to reflect the next working day to
which I am working on, and it also covers holidays etc..

tn = Now()
cDat = Weekday(tn, vbMonday)

If (cDat = 5) Then
cDat = Format((tn + 2) + WED, "dd/mm/yyyy")
Else
cDat = Format(tn + WED, "dd/mm/yyyy")
End If

For Each c In myRng
If c <> "" Then
With c
.NumberFormat = "dd/mm/yyyy"
.Value = cDat
End With
End If
Next c

End Sub

As you can clearly see, I also format the date programatically to ensure
it happens, but it doesn't... o_O

Appreciate any assistance.

Mick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top