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
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Snakehips

Well-known Member
Joined
May 17, 2009
Messages
5,563
Office Version
  1. 365
  2. 2010
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!
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,629
Messages
5,838,454
Members
430,549
Latest member
jayjay2022

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
Top