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 8952125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:48:24+00:00 2026-06-15T13:48:24+00:00

I have a variable fila with a full line with Excel’s values The problem

  • 0

I have a variable fila with a full line with Excel’s values

The problem is when in Excel I have #N/A, VBA takes that value like Error 2042.

I cannot assign that value to valor and produce an error. Until this point everything is ok, now I am trying to define a On Error Goto to go to the next iteration in the For loop, but I do not know why VBA doesn’t handle the error.

Do While Not IsEmpty(ActiveCell)

    txt = ActiveCell.Value2
    cell = ActiveCell.Offset(0, 1).Value2       
    fila = Range("C20:F20")

    For j = 1 To UBound(fila, 2)
        On Error GoTo Siguiente
        If Not IsEmpty(fila(1, j)) Then            
            valor = fila(1, j)
            cmd = Cells(1, j + 2).Value2
            devolver = function1(cmd, txt, cell, valor)
            arrayDevolver(p) = devolver
            p = p + 1                
        End If
Siguiente:
    Next
Loop 
  • 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-15T13:48:26+00:00Added an answer on June 15, 2026 at 1:48 pm

    This is not a VBA error – so error handling won’t catch it. To detect this issue use IsError before writing to your array

    The simple code below handles the Error 2042 problem with this test

    Sub Test()
        Dim varIn As Variant
        [a1].FormulaR1C1 = "=NA()"
        If IsError([a1].Value2) Then
            varIn = "skip record"
        Else
            varIn = [a1].Value2
        End If
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So let's say I have variable like this one: $q = DB::select('id')->from('reports')->where('field', '=', 'value');;
I have problem with getting value of parameter when I have variable with some
I have several buttons that have variable width and I would like them to
here i have variable fileVal takes path of file like uploads/import/abc.pdf var fileVal =
I have variable that get's value of checked radio button named: parentcheck I wanna
i have variable in HTML which stores values 835 i want that befor 835
I have variable which I populate from JSON formated data. Something like: var time=my_data[data.results[i].id].time;
I have variable @count of datatype int.I am setting values to this @count. I
I'm studying javascript these days and I have question. I have variable that contain
i have variable in sql server like DECLARE @Country varchar(max) SET @Country='GB,US' here country

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.