LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 151
Default Date formatting issue VB

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.
 
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
Formatting issue Iriemon Excel Worksheet Functions 2 February 24th 10 03:23 PM
formatting issue Roger on Excel Excel Programming 1 July 29th 08 10:20 PM
formatting issue- date format dominates learningaccess Excel Worksheet Functions 8 November 30th 07 12:56 AM
formatting issue? chip_pyp Excel Discussion (Misc queries) 4 January 31st 06 09:22 PM
Date formatting issue in user form Jennifer Excel Programming 3 April 16th 05 09:49 AM


All times are GMT +1. The time now is 04:29 PM.

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"