Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7884715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:52:30+00:00 2026-06-03T04:52:30+00:00

What would cause this line If Cells(i, 3) = Or VBA.Left(Cells(i, 3), 5) =

  • 0

What would cause this line

If Cells(i, 3) = "" Or VBA.Left(Cells(i, 3), 5) = "BIGA-" Or VBA.Left(Cells(i, 3), 5) = "BRNG-" Or VBA.Left(Cells(i, 3), 5) = "ENER-" Or VBA.Left(Cells(i, 3), 5) = "EURE-" Or VBA.Left(Cells(i, 3), 5) = "STRE-" Then Rows(i).Delete

in the below macro to return a Run-Time Error ’13’ Type Mismatch after the first cell record is found and deleted?

Option Explicit

Sub deletedExceptions_row()
Dim i As Long
For i = Cells.SpecialCells(xlCellTypeLastCell).Row To 1 Step -1
    If Cells(i, 3) = "" Or 
    VBA.Left(Cells(i, 3), 5) = "BIGA-" Or 
    VBA.Left(Cells(i, 3), 5) = "BRNG-" Or 
    VBA.Left(Cells(i, 3), 5) = "ENER-" Or 
    VBA.Left(Cells(i, 3), 5) = "EURE-" Or 
    VBA.Left(Cells(i, 3), 5) = "STRE-" Then
    Rows(i).Delete
Next i
End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T04:52:31+00:00Added an answer on June 3, 2026 at 4:52 am

    Try this

    Option Explicit
    
    Sub deletedExceptions_row()
        Dim i As Long
        Dim ws As Worksheet
    
        On Error GoTo whoa
    
        Set ws = Sheets("Sheet1")
    
        With ws
            For i = .Cells.SpecialCells(xlCellTypeLastCell).Row To 1 Step -1
                If .Cells(i, 3) = "" Or _
                VBA.Left(.Cells(i, 3), 5) = "BIGA-" Or _
                VBA.Left(.Cells(i, 3), 5) = "BRNG-" Or _
                VBA.Left(.Cells(i, 3), 5) = "ENER-" Or _
                VBA.Left(.Cells(i, 3), 5) = "EURE-" Or _
                VBA.Left(.Cells(i, 3), 5) = "STRE-" Then
                    .Rows(i).Delete
                End If
            Next i
        End With
        Exit Sub
    whoa:
        MsgBox "Value of i is " & i, vbInformation, Err.Description
    End Sub
    

    Now does it give an error? If it does then what is the value of i. If the value of i is say 17 then check the cell C17. I am sure there is a formula in that cell which is giving an error. For example #DIV/0! or any other error. It is only in this scenario will it give a type mismatch error.

    SNAPSHOT

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to remove the first line: !string.IsNullOrEmpty(cell.Text) will this cause any issue? I
Why does this line of code cause Excel not to exit? Excel.Range range =
I would like to center a text element (in this case, the h2 sub-headline)
What would be the best practice for sharing localization object (in this case ResourceBundle,
So I have a Rails app (which in this case seems like it would
This would seem to be the case in Firefox 3.5+, there I can instantiate
This is what I thought would be a simple select clause, however the following
Ok guys, I know this is pretty a rare case but I really would
Is there any reason why printw() would cause a segmentation fault? Code is fine
What would possibly cause a 'git push' to try and commit to two branches?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.