Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default input box date type mismatch

Hi Guys - another newbie question. Seem to be a lot of similar ones around
this theme but can't see my problem excactly, so here goes:

User input date is used to find a match in a range of dates in the
following code:

res = InputBox("Please enter Start Date")
If IsDate(res) Then
dt = CDate(res) 'convert response to a date type
res1 = Application.Match(CLng(dt), Rows(6), 0)
rest of code

This works a treat (Thanks Tom Oliver!) in one application,
but have copied it to use in another and I get an error 2042 and type
mismatch in the second. I have formatted the target date range in the same
way in both (I thought) so am baffled.

Many TIA'a

Matilda


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default input box date type mismatch

It works fine as far as I can see. Where do you get the error, and what are
you typing in the inputbox.

BTW, his name is Tom Ogilvy!

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Matilda" wrote in message
...
Hi Guys - another newbie question. Seem to be a lot of similar ones around
this theme but can't see my problem excactly, so here goes:

User input date is used to find a match in a range of dates in the
following code:

res = InputBox("Please enter Start Date")
If IsDate(res) Then
dt = CDate(res) 'convert response to a date type
res1 = Application.Match(CLng(dt), Rows(6), 0)
rest of code

This works a treat (Thanks Tom Oliver!) in one application,
but have copied it to use in another and I get an error 2042 and type
mismatch in the second. I have formatted the target date range in the same
way in both (I thought) so am baffled.

Many TIA'a

Matilda




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default input box date type mismatch


Hi Bob - of course it is! what was I thinking? I actually have his name
pasted in my code in recognition of his contribution (as I do any time I have
been helped) and it is right there, so must have had a blonde moment! Thanks
for pointing it out.

In put is in dd/mm/yy format, and target range is dd/mm/yyyy but Cdate
handles that. As I said, behaves fine in case 1.
Error is last line I quoted, tooltip over res1 in statement reads error 2042
instead of stating the value of dt match converted to a long.

Same code both applications, same job to do, same data types, formats etc.

Of course it's something stupid, I just can't spot it.

M.

"Bob Phillips" wrote:

It works fine as far as I can see. Where do you get the error, and what are
you typing in the inputbox.

BTW, his name is Tom Ogilvy!

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Matilda" wrote in message
...
Hi Guys - another newbie question. Seem to be a lot of similar ones around
this theme but can't see my problem excactly, so here goes:

User input date is used to find a match in a range of dates in the
following code:

res = InputBox("Please enter Start Date")
If IsDate(res) Then
dt = CDate(res) 'convert response to a date type
res1 = Application.Match(CLng(dt), Rows(6), 0)
rest of code

This works a treat (Thanks Tom Oliver!) in one application,
but have copied it to use in another and I get an error 2042 and type
mismatch in the second. I have formatted the target date range in the same
way in both (I thought) so am baffled.

Many TIA'a

Matilda





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default input box date type mismatch

Ooops!

Bob, I have discovered the problem, and it is trooooly stoooopid!

I am well aware of the dangers of hardcoding, but the syntax soup required
to reference in excel forces me to use the odd fixed range as an expedient
sometimes.
I simply hadn't checked the reference in the second application, ( somthing
I would have done if I was less weary at this point.!)

Forgive me for wasting this valuable help resource on my own blind stupidity!

Regards,

M

"Matilda" wrote:


Hi Bob - of course it is! what was I thinking? I actually have his name
pasted in my code in recognition of his contribution (as I do any time I have
been helped) and it is right there, so must have had a blonde moment! Thanks
for pointing it out.

In put is in dd/mm/yy format, and target range is dd/mm/yyyy but Cdate
handles that. As I said, behaves fine in case 1.
Error is last line I quoted, tooltip over res1 in statement reads error 2042
instead of stating the value of dt match converted to a long.

Same code both applications, same job to do, same data types, formats etc.

Of course it's something stupid, I just can't spot it.

M.

"Bob Phillips" wrote:

It works fine as far as I can see. Where do you get the error, and what are
you typing in the inputbox.

BTW, his name is Tom Ogilvy!

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Matilda" wrote in message
...
Hi Guys - another newbie question. Seem to be a lot of similar ones around
this theme but can't see my problem excactly, so here goes:

User input date is used to find a match in a range of dates in the
following code:

res = InputBox("Please enter Start Date")
If IsDate(res) Then
dt = CDate(res) 'convert response to a date type
res1 = Application.Match(CLng(dt), Rows(6), 0)
rest of code

This works a treat (Thanks Tom Oliver!) in one application,
but have copied it to use in another and I get an error 2042 and type
mismatch in the second. I have formatted the target date range in the same
way in both (I thought) so am baffled.

Many TIA'a

Matilda





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default input box date type mismatch

No problem.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Matilda" wrote in message
...
Ooops!

Bob, I have discovered the problem, and it is trooooly stoooopid!

I am well aware of the dangers of hardcoding, but the syntax soup required
to reference in excel forces me to use the odd fixed range as an expedient
sometimes.
I simply hadn't checked the reference in the second application, (

somthing
I would have done if I was less weary at this point.!)

Forgive me for wasting this valuable help resource on my own blind

stupidity!

Regards,

M

"Matilda" wrote:


Hi Bob - of course it is! what was I thinking? I actually have his name
pasted in my code in recognition of his contribution (as I do any time I

have
been helped) and it is right there, so must have had a blonde moment!

Thanks
for pointing it out.

In put is in dd/mm/yy format, and target range is dd/mm/yyyy but Cdate
handles that. As I said, behaves fine in case 1.
Error is last line I quoted, tooltip over res1 in statement reads error

2042
instead of stating the value of dt match converted to a long.

Same code both applications, same job to do, same data types, formats

etc.

Of course it's something stupid, I just can't spot it.

M.

"Bob Phillips" wrote:

It works fine as far as I can see. Where do you get the error, and

what are
you typing in the inputbox.

BTW, his name is Tom Ogilvy!

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Matilda" wrote in message
...
Hi Guys - another newbie question. Seem to be a lot of similar ones

around
this theme but can't see my problem excactly, so here goes:

User input date is used to find a match in a range of dates in the
following code:

res = InputBox("Please enter Start Date")
If IsDate(res) Then
dt = CDate(res) 'convert response to a date type
res1 = Application.Match(CLng(dt), Rows(6), 0)
rest of code

This works a treat (Thanks Tom Oliver!) in one application,
but have copied it to use in another and I get an error 2042 and

type
mismatch in the second. I have formatted the target date range in

the same
way in both (I thought) so am baffled.

Many TIA'a

Matilda









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
error 13 type mismatch input box cluckers Excel Discussion (Misc queries) 1 October 28th 09 07:01 PM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
Date Type Mismatch johncassell[_5_] Excel Programming 3 July 21st 05 09:44 AM
Date type mismatch Patti[_2_] Excel Programming 4 September 14th 04 05:15 PM
Type Mismatch on Date Cameron[_4_] Excel Programming 2 December 5th 03 01:56 PM


All times are GMT +1. The time now is 10:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"