run-time error '13'

NicholasP

Active Member
Joined
Nov 18, 2006
Messages
289
Hi all, I have this bit of code that is not working and I do not know w


Code:
Do

If IsError(Cells(tp_rw_dte, 4)) = False Then
     tp_rw_dte = tp_rw_dte + 1
End If

Loop Until IsError(Cells(tp_rw_dte, 4)) = True Or Cells(tp_rw_dte, 4) = ""

It loops through the cells just fine, but on the first error it encounters, it breaks. I checked the immediate window; IsError(Cells(tp_rw_dte, 4)) does indeed equal true.

Any help would be greatly appreciated.

Thanks
Nick
 

Some videos you may like

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Snakehips

Well-known Member
Joined
May 17, 2009
Messages
5,059
Office Version
  1. 2013
Platform
  1. Windows
Nick,

Perhaps try...

Code:
Do Until IsError(Cells(tp_rw_dte, 4))
If Cells(tp_rw_dte, 4) = "" Then Exit Do
     tp_rw_dte = tp_rw_dte + 1
Loop

Hope that helps
 

NicholasP

Active Member
Joined
Nov 18, 2006
Messages
289
I changed it to

Loop Until IsError(Cells(tp_rw_dte, 4)) = True Or IsEmpty(Cells(tp_rw_dte, 4)) = True

And that seemed to have fixed it. Thanks for your response!
 

Watch MrExcel Video

Forum statistics

Threads
1,109,518
Messages
5,529,314
Members
409,863
Latest member
stacy09
Top