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

  • Home
  • SEARCH
  • 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 6957199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:58:09+00:00 2026-05-27T14:58:09+00:00

Sub Driver() ‘Highlights driver who have 1 point Dim driverData ‘ array variable to

  • 0
Sub Driver()

'Highlights driver who have 1 point

Dim driverData  ' array variable to hold driver names

driverData = Range("C2:C391").Value

ReDim driverData(390)

MsgBox driverData(3)

Though Range(“C2:C391”) has values in the worksheet, the array seems to be having only blanks

So, using the MsgBox command, only a blank appears

  • 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-27T14:58:10+00:00Added an answer on May 27, 2026 at 2:58 pm

    When you use just ReDim you clober all the contents in the array. You need to use ReDim Preserve to keep elements that are in the array.

    That being said, the you can’t simply redim a 2D array into a 1D array. You can do this:

    Sub test()
    
    Dim driverData As Variant
    Dim newArray() As String
    
    driverData = Range("C2:C391").Value
    
    ReDim newArray(1 To UBound(driverData, 1))
    For i = 1 To UBound(driverData)
        newArray(i) = driverData(i, 1)
    Next
    
    MsgBox newArray(3)
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Private Sub Command1_Click() Dim x As Integer For x = 1 To 100 List1.AddItem
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress Dim allowedChars
Private Sub Command1_Click() Dim dom As New DOMDocument Dim http As New XMLHTTP Dim
I have classX: Sub New(ByVal item_line_no As String, ByVal item_text As String) ' check
i have a sub with this signature Public Sub Save(ByVal obj As IPta) now
While attempting my first sub-class in Objective-C I have come across the following warning
We have a sub-project 'commonUtils' that has many generic code-snippets used across the parent
In a VB6 program: Dim conn As Object Set conn = CreateObject(ADODB.Connection) conn.Open DRIVER={SQL
I have a legacy VB6 program which installs an Access file in a sub-directory
I have an error ERROR [22018] [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in

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.