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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:13:01+00:00 2026-06-12T04:13:01+00:00

For some reason I’m getting a ‘Runtime 13’ error when I execute the following

  • 0

For some reason I’m getting a ‘Runtime 13’ error when I execute the following code.

Dim N_1 As Variant

Worksheets("Trucks").Activate
Range("G9").Activate

Do Until ActiveCell.Value = ""
ActiveCell.Offset(1, 0).Select
If ActiveCell.Value = "" Then Exit Do
Loop

ActiveCell.Offset(-1, 0).Select
N_1 = Range(ActiveCell, "G9")

With CreateObject("scripting.dictionary")
    .comparemode = vbTextCompare
    For Each v1 In N_1
        If Not IsEmpty(v1) Then
            If Not .exists(v1) Then .Add v1, Nothing
        End If
    Next
    z1 = .keys
End With
  • 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-12T04:13:02+00:00Added an answer on June 12, 2026 at 4:13 am

    Range(...) returns an object type so Set must be used:

    Set N_1 = Range(ActiveCell, "G9")


    While Range(...) does return an object type, assigning it to a Variant without using Set produces a 2D variant array of the cell values in the range. This works OK with the For Each v1 in N_1 part and with the IsEmpty(v1) part.

    Therefore, I’m not 100% sure why you got error 13 in the first place (assuming that v1 and z1 are also declared as Variant). Indeed if you use Set you’ll also have to alter your loop which populates the dictionary to use v1.Value instead of just v1

    If you are subsequently using N_1 and expecting it to be a Range object then this would explain things but the code as presented above runs OK for me if everything is declared as a Variant:

    Excel screenshot showing the code from the question running without errors

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

Sidebar

Related Questions

For some reason if I try to display data with the following code, I
For some reason the following code is giving me an exception. <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries>
For some reason, this line of code is returning undefined for $(this).attr(href) $(a).attr(href, javascript:page('
For some reason, my spec isn't passing. It appears that @categories isn't getting to
For some reason, I am getting a weird overlapping dropdown menu glitch. It works
For some reason my Xcode project doesn't recognize (autocorrect) my code. It doesn't color-code
For some reason my javascript won't execute when my submit button is pressed. It's
For some reason my code works for all the 10 digit numbers but not
For some reason I am getting the number or rows and not the results
For some reason this code is not checking the current password with the database

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.