Pasting a date to a cell from UserForm

P

Patrick C. Simonds

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
 
F

FSt1

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 herethis 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
 
F

FSt1

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
 

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

Similar Threads


Top