Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
I was guessing that this line:
ActiveCell.FormulaR1C1 = QuoteDay & "/" & QuoteMonth & "/" & QuoteYear Was actually filling the cell with the value from the textbox. (But I didn't look at the code enough to see what called what, and where QuoteDay/QuoteMonth/QuoteYear were updated.) with activesheet.range("H9") If IsDate(UserForm1.TxtQuoteDay.Text) Then .value = CDate(UserForm1.TxtQuoteDay.Text) .NumberFormat = "mm/dd/yyyy" Else .value = "Not a date" End If end with Although, I would suspect that it would be better to validate your date before you try to plop it back into the worksheet. Nigel wrote: Hi, It still shows the // no matter what format i change the cell to. I have looked at your remedy but not entirely sure where to put it. Regards, Nigel <<snipped |
#2
![]() |
|||
|
|||
![]()
Hi,
I have solved the problem thats to your direction. QuoteDay & "\" & QuoteMonth & "\" & QuoteYear is what i used to use but when i changed it around to give me todays date, ( i used to select date, mont from cbo box) i forgot to edit here so the\\ was infact coming from here. now removed. no more \\ :) Thanks, Nigel "Dave Peterson" wrote: I was guessing that this line: ActiveCell.FormulaR1C1 = QuoteDay & "/" & QuoteMonth & "/" & QuoteYear Was actually filling the cell with the value from the textbox. (But I didn't look at the code enough to see what called what, and where QuoteDay/QuoteMonth/QuoteYear were updated.) with activesheet.range("H9") If IsDate(UserForm1.TxtQuoteDay.Text) Then .value = CDate(UserForm1.TxtQuoteDay.Text) .NumberFormat = "mm/dd/yyyy" Else .value = "Not a date" End If end with Although, I would suspect that it would be better to validate your date before you try to plop it back into the worksheet. Nigel wrote: Hi, It still shows the // no matter what format i change the cell to. I have looked at your remedy but not entirely sure where to put it. Regards, Nigel <<snipped |
#3
![]() |
|||
|
|||
![]()
Glad you got it working.
Nigel wrote: Hi, I have solved the problem thats to your direction. QuoteDay & "\" & QuoteMonth & "\" & QuoteYear is what i used to use but when i changed it around to give me todays date, ( i used to select date, mont from cbo box) i forgot to edit here so the\\ was infact coming from here. now removed. no more \\ :) Thanks, Nigel "Dave Peterson" wrote: I was guessing that this line: ActiveCell.FormulaR1C1 = QuoteDay & "/" & QuoteMonth & "/" & QuoteYear Was actually filling the cell with the value from the textbox. (But I didn't look at the code enough to see what called what, and where QuoteDay/QuoteMonth/QuoteYear were updated.) with activesheet.range("H9") If IsDate(UserForm1.TxtQuoteDay.Text) Then .value = CDate(UserForm1.TxtQuoteDay.Text) .NumberFormat = "mm/dd/yyyy" Else .value = "Not a date" End If end with Although, I would suspect that it would be better to validate your date before you try to plop it back into the worksheet. Nigel wrote: Hi, It still shows the // no matter what format i change the cell to. I have looked at your remedy but not entirely sure where to put it. Regards, Nigel <<snipped -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to format a date to a different format | Excel Discussion (Misc queries) | |||
Date Math Problem | Excel Worksheet Functions | |||
Date format on a drop down box | Excel Discussion (Misc queries) | |||
Converting numbers to date format from csv files | Excel Discussion (Misc queries) | |||
Problem with date base units for x axis | Charts and Charting in Excel |