ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Type Mismatch on Date (https://www.excelbanter.com/excel-programming/284416-type-mismatch-date.html)

Cameron[_4_]

Type Mismatch on Date
 
Hello folks,

Looking for some help here, I've tried searching as I suspect this is
a common problem, but I haven't been able to come up with an answer.

I've inherited an excel file that links to data in access. It's got a
macro that runs and it says there's a type mismatch on this command:

MinDate = .Cells(3, 1).Value

If I go into the debugger and just start the macro up again, it runs
fine.

So my problem is with that cell. In that cell is this:

=Msaccess|'S:\PROD&QA\VA_proj\DATABASE\vaprog.mdb; Table Dateform
Table'!All

When the macro tries to get the value from that cell, there is a #N/A
as the value. After the debugger opens, the value has changed to
12/1/2003, or a date.

Any suggestions?

thanks,
Cameron

Bill Manville

Type Mismatch on Date
 
Cameron wrote:
I've inherited an excel file that links to data in access. It's got a
macro that runs and it says there's a type mismatch on this command:

MinDate = .Cells(3, 1).Value


Looks like the macro is running before the data has arrived.

Maybe something like this

Do While WorksheetFunction.ISNA(.Cells(3,1).Value)
DoEvents
Loop
MinDate = .Cells(3, 1).Value

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup


Cameron[_4_]

Type Mismatch on Date
 
That works, thanks Bill!!

Bill Manville wrote in message
Looks like the macro is running before the data has arrived.

Maybe something like this

Do While WorksheetFunction.ISNA(.Cells(3,1).Value)
DoEvents
Loop
MinDate = .Cells(3, 1).Value

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup



All times are GMT +1. The time now is 12:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com