Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 343
Default Pasting a date to a cell from UserForm

On my UserForm is a TextBox which gets populated during the UserForm
Initialization and it displays in the ddd dd mmm yy format (see first
set of code) this is so it is easier for the user when talking to the client
because they can refer to the day of the week. Some times they have to edit
the text entering the date as mm/dd/yy but when the value gets copied to the
cell a totally different date is displayed. Any thoughts?






TextBox7.Value = rng(1, 17) ' Date
of 1st Additional Contact Attempt
Me.TextBox7.Value = Format$(TextBox7.Value, "ddd dd mmm yy")




rng(1, 17) = Format(Mid(TextBox7.Value, 5), "mm/dd/yy") '1st Attemp Date
rng(1, 18).Value = TextBox6.Text '1st Attemp Time

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Pasting a date to a cell from UserForm

hi,
guessing here because i can't test. you have only posted bits and pieces of
your code.
but i think your problem is with the mid function.
you initialize the form with "ddd dd mmm yy" and the mid functions seems to
be moving that to the sheet as "mm/dd/yy". but the mid function seem
incomplete. should look like
''Format(Mid(TextBox7.Value, 5, 10), "mm/dd/yy")
but as said, i can't test.

i think your problem is here
Some times they have to edit the text entering the date as mm/dd/yy

this would throw the mid function as written off.

seem like you need a test of length on textbox1.

if LEN(me.textbox1.value)9 then
rng(1, 17) = Format(Mid(TextBox7.Value, 5), "mm/dd/yy")
else
rng(1, 17) =TextBox7.Value
end if

since i can't test, this is all a guess.
trying and see. post back if problems.
i'll be crashing soon so i may have to pick it up tomorrow.

regards
FSt1

"Patrick C. Simonds" wrote:

On my UserForm is a TextBox which gets populated during the UserForm
Initialization and it displays in the ddd dd mmm yy format (see first
set of code) this is so it is easier for the user when talking to the client
because they can refer to the day of the week. Some times they have to edit
the text entering the date as mm/dd/yy but when the value gets copied to the
cell a totally different date is displayed. Any thoughts?






TextBox7.Value = rng(1, 17) ' Date
of 1st Additional Contact Attempt
Me.TextBox7.Value = Format$(TextBox7.Value, "ddd dd mmm yy")




rng(1, 17) = Format(Mid(TextBox7.Value, 5), "mm/dd/yy") '1st Attemp Date
rng(1, 18).Value = TextBox6.Text '1st Attemp Time


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Pasting a date to a cell from UserForm

i screwed up
the if clause should look like this.

if LEN(me.textbox7.value)9 then
rng(1, 17) = Format(Mid(TextBox7.Value, 5), "mm/dd/yy")
else
rng(1, 17) =TextBox7.Value
end if


sorry. typo

regards
FSt1

"FSt1" wrote:

hi,
guessing here because i can't test. you have only posted bits and pieces of
your code.
but i think your problem is with the mid function.
you initialize the form with "ddd dd mmm yy" and the mid functions seems to
be moving that to the sheet as "mm/dd/yy". but the mid function seem
incomplete. should look like
''Format(Mid(TextBox7.Value, 5, 10), "mm/dd/yy")
but as said, i can't test.

i think your problem is here
Some times they have to edit the text entering the date as mm/dd/yy

this would throw the mid function as written off.

seem like you need a test of length on textbox1.

if LEN(me.textbox1.value)9 then
rng(1, 17) = Format(Mid(TextBox7.Value, 5), "mm/dd/yy")
else
rng(1, 17) =TextBox7.Value
end if

since i can't test, this is all a guess.
trying and see. post back if problems.
i'll be crashing soon so i may have to pick it up tomorrow.

regards
FSt1

"Patrick C. Simonds" wrote:

On my UserForm is a TextBox which gets populated during the UserForm
Initialization and it displays in the ddd dd mmm yy format (see first
set of code) this is so it is easier for the user when talking to the client
because they can refer to the day of the week. Some times they have to edit
the text entering the date as mm/dd/yy but when the value gets copied to the
cell a totally different date is displayed. Any thoughts?






TextBox7.Value = rng(1, 17) ' Date
of 1st Additional Contact Attempt
Me.TextBox7.Value = Format$(TextBox7.Value, "ddd dd mmm yy")




rng(1, 17) = Format(Mid(TextBox7.Value, 5), "mm/dd/yy") '1st Attemp Date
rng(1, 18).Value = TextBox6.Text '1st Attemp Time


Reply
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
Copying Date and pasting special - DATE CHANGES?!? David Excel Worksheet Functions 5 January 15th 10 11:21 PM
Pasting #-# as text and not a date lcshrm Excel Discussion (Misc queries) 5 March 16th 07 03:12 AM
Copying and Pasting froma Userform Richard Excel Programming 1 May 18th 04 09:20 AM
Copying and Pasting froma Userform Richard Excel Programming 0 May 18th 04 09:10 AM
code pasting a date changes date format in current month only Edward[_5_] Excel Programming 0 May 10th 04 06:13 PM


All times are GMT +1. The time now is 08:27 AM.

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"