autofilter and vba

  • Thread starter Thread starter John Smith
  • Start date Start date
J

John Smith

Hi,

I have a problem with excel2003.
UserForm has a textbox which is used to enter a date.
Autofilter is used to show data between two different dates.
It works(partly) as works the autofilter part of the macro(partly).
Partly means that autofilter part works when entering a date to the cell
by hand, but not when used through textbox.
Somehow the textbox is doing something with the data (in this case a
date). After entering the date through textbox You even can't autofilter
it by hand.

Does anyone know what happens to data when it's entered through textbox.
eg. Worksheets(3).Range("A2").Value = txtDate.Value

TIA,
tomi
 
Tomi,

Try casting the date

Worksheets(3).Range("A2").Value = CDate(txtDate.Value)

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
 
Bob,

Thanks That worked, althou I had to add CLng to Your suggestion (as
follows):

Worksheets(3).Range("A2").Value = CLng(CDate(txtDate.Value))
(as i prefer dates like dd.mm.yyyy

BRGDS,
Tomi
 

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

Back
Top