ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Desperation is Setting in - Date Formats! :-( (https://www.excelbanter.com/excel-programming/350467-desperation-setting-date-formats.html)

Zani

Desperation is Setting in - Date Formats! :-(
 
I have a series of UserForms capturing and writing data to an worksheet,
trouble is no matter how I format anything cannot get the format of a date
entered in the UserForm to match the worksheet formats. ie When I enter
05/02/06 (5th Feb 06)on the UserForm it is transposed to 02/05/06 (2nd May
06) on the worksheet!

Am I going nuts or is there a way to get around this - it's seriously
knocking my plug in now!

--
Zani
(if I have posted here, I really am stuck!)


Yngve

Desperation is Setting in - Date Formats! :-(
 
Hi Zani

You have to set right format on cells

Regads Yngve


Zani

Desperation is Setting in - Date Formats! :-(
 
Hi, no that's not it. the cell formats are OK, it is something weird to do
with VB being in US format, and I am working in UK format - am so confused!!!!
--
Zani
(if I have posted here, I really am stuck!)



"Yngve" wrote:

Hi Zani

You have to set right format on cells

Regads Yngve



Norman Jones

Desperation is Setting in - Date Formats! :-(
 
Hi Zani,

Try:

Range("A1").Value = CDate(Me.TextBox1.Value)

---
Regards,
Norman



"Zani" wrote in message
...
I have a series of UserForms capturing and writing data to an worksheet,
trouble is no matter how I format anything cannot get the format of a date
entered in the UserForm to match the worksheet formats. ie When I enter
05/02/06 (5th Feb 06)on the UserForm it is transposed to 02/05/06 (2nd May
06) on the worksheet!

Am I going nuts or is there a way to get around this - it's seriously
knocking my plug in now!

--
Zani
(if I have posted here, I really am stuck!)




Toppers

Desperation is Setting in - Date Formats! :-(
 
Zani,

For a previous posting (thanks to Tom Ogilvy):

Private Sub textbox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Range("a1") = CDate(TextBox1.Text)
Range("a1").NumberFormat = "dd/mm/yy"
End Sub

I am UK-Based and share your frustration.

HTH

End Sub"Zani" wrote:

Hi, no that's not it. the cell formats are OK, it is something weird to do
with VB being in US format, and I am working in UK format - am so confused!!!!
--
Zani
(if I have posted here, I really am stuck!)



"Yngve" wrote:

Hi Zani

You have to set right format on cells

Regads Yngve



Yngve

Desperation is Setting in - Date Formats! :-(
 
Hi Zani

TextBox1.Value = Format(TextBox1.Value, "dd-mmm-yyyy")

Regards Yngve


Zani

Desperation is Setting in - Date Formats! :-(
 
Thanks chaps - your posts came just in time to stop me throwing myself off
the roof - I thought I was going nuts! One to remember for the future me
thinks.

Thanks again - only hope I will be knowledgeable enough one day to help
people in return.
--
Zani
(if I have posted here, I really am stuck!)



"Norman Jones" wrote:

Hi Zani,

Try:

Range("A1").Value = CDate(Me.TextBox1.Value)

---
Regards,
Norman



"Zani" wrote in message
...
I have a series of UserForms capturing and writing data to an worksheet,
trouble is no matter how I format anything cannot get the format of a date
entered in the UserForm to match the worksheet formats. ie When I enter
05/02/06 (5th Feb 06)on the UserForm it is transposed to 02/05/06 (2nd May
06) on the worksheet!

Am I going nuts or is there a way to get around this - it's seriously
knocking my plug in now!

--
Zani
(if I have posted here, I really am stuck!)






All times are GMT +1. The time now is 06:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com