type mismatch:error 13

earp_

Active Member
Joined
Apr 30, 2008
Messages
305
Hi,
when I open my excel file i've got this error
Run Time error 13
Type Mismatch
and this line
If .Value >= TimeSerial(9, 0, 0) And .Value < TimeSerial(9, 5, 0) Then
of this structure
If .Value >= TimeSerial(7, 0, 0) And .Value < TimeSerial(7, 30, 0) Then
With ThisWorkbook
Worksheets("Sheet1").Range("B2").Copy
Worksheets("Sheet2").Range("A65536").End(xlUp).Offset(1, 0).PasteSpecial xlValues
End With
If (myEnter = 0) Then
myEnter = 1
End If
End If
is underlined.
If I run stop the macro and run it again, I have no problem.
Why?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I see....
the parent object is
With Sheets("Sheet1").Range("J2")
but this value is #NA when I open my excel file and becomes a value after 2 seconds.
So I guess that is the reason.
Is there any way to put a "sleep" or something like that, for 3 seconds sleep?
 
Upvote 0
mmm strange I'm still getting the error.
and in J2 the format is
<table x:str="" style="border-collapse: collapse; width: 78pt;" border="0" cellpadding="0" cellspacing="0" width="104"><col style="width: 78pt;" width="104"><tr style="height: 15pt;" height="20"> <td class="xl24" style="height: 15pt; width: 78pt;" x:num="0.46809027777777779" align="right" width="104" height="20">11:14:03 AM</td> </tr></table>
while the macro starts with
With Sheets("Sheet1").Range("J2")
'7.00
If .Value >= TimeSerial(7, 0, 0) And .Value < TimeSerial(7, 30, 0) Then
 
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,039
Members
448,940
Latest member
mdusw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top