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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:58:20+00:00 2026-05-14T18:58:20+00:00

I have an array set up Dim managerList(1 To 50, 1 To 100) As

  • 0

I have an array set up

Dim managerList(1 To 50, 1 To 100) As String

what I am trying to do, is set the first, second, and third elements in the row

managerList(index,1) = tempManagerName
managerList(index,2) = tempIdeaNumber
managerList(index,3) = 1    

But get an error when I try to do that saying that the object variable is not set. I maintain index as an integer, and the value corresponds to a single manager, but I can’t seem to manually set the third element. The first and second elements set correctly.

On the flip side, I have the following code that will allow for the element to be set,

For x=1 To 50
  If StrConv(tempManagerName,3) = managerList(x,1) Then
    found = x 
      For y=3 to 100
        If managerList(x,y) = "" Then                                                                       
          managerList(x,y) = tempIdeaNumber                                                                                             
            Exit for
    End If
      Next

     Exit For
  End If
Next

It spins through the array (laterally) trying to find an empty element. Ideally I would like to set the index of the element the y variable is on into the 3rd element in the row, to keep a count of how many ideas are on the row.

What is the best way to keep a count like this? Any idea why I am getting a Object variable not set error when I try to manually set the element?

  • 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-05-14T18:58:21+00:00Added an answer on May 14, 2026 at 6:58 pm

    object variable not set means that you are trying to call methods or access properties on an un-initialized object. I don’t see anything like that in the code snippets you have published, are you sure the error occurs in those lines?

    A good way to pin-point errors is to include the module and line number in the error message. Add this around your subroutine to get a more detailed message:

    Sub Initialize
        On Error Goto errorthrower  
        //
        // your code goes here...
        //
        Exit sub
    ErrorThrower:
        Error Err, Str$(Err) & " " & Error & Chr(13) + "Module: " & Cstr( Getthreadinfo(1) ) & ", Line: " & Cstr( Erl )
    End sub
    

    (I originally found this on Ferdy Christants blog)

    It’s not quite clear what problem you are trying to resolve here, but it looks like you have 1..50 “managers” that can have 1..100 “ideas” ? I’d make a class for managers instead:

    Class manager
        Private managername As String
        Private ideas(1 To 100) As String
    
        Sub new(managername As String)
                Me.managername=managername
        End Sub
    
        // whatever methods you need....
    
    End Class
    

    Then, I’d keep track of them with a list of these objects:

        Dim managerlist List As manager
    
        Dim key As String
        key = Strconv(tempmanagername,3)
    
        if not iselement(managerlist(key)) then 
            set managerlist(key) = new manager(key)
        end if
    
        Dim currentmanager As manager
        Set currentmanager = managerlist(key)
    

    This is only an example to get you started, you will have to adapt this to solve your actual problem.

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

Sidebar

Related Questions

I have a ListView control on my form set up like this in details
I cannot figure out how to set an array to one of two sets
I have a result string with the following structure <items> <item> <id> I must
I'm having a problem when trying to pass an array back to a COM
I am having trouble converting some code from VB6 to VB.NET (I don't have
What is the best way for me to have several datasets ? i've thought
HI, I am trying to convert the following vba code to c# and i
I'm really sorry. This must seem like an incredibly stupid question, but unless I
I am a newbie to VBS scripting. Thanks for all your comments! I fixed

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.