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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:36:11+00:00 2026-06-11T16:36:11+00:00

In the situation where the user select two non-contiguous column ranges i wrote the

  • 0

In the situation where the user select two non-contiguous column ranges i wrote the following:

Dim count long
Dim points variant
Dim i long

Set user_range = ActiveWindow.RangeSelection

count = user_range.count / 2

ReDim points(1 To count, 1 To 2)

For i = 1 To count

    MsgBox "value is" & user_range.Areas.Item(1).Value(i,1)

    points(i, 1) = user_range.Areas.Item(1).Value(i,1)

    points(i, 2) = user_range.Areas.Item(2).Value(i,1)


Next i

But i get an object error when i try this. Am i indexing Value wrong?

This should work right? Is there an easier way to do this?

Any help is greatly appreciated!

Thanks,

Russ

  • 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-11T16:36:12+00:00Added an answer on June 11, 2026 at 4:36 pm

    I’m afraid your code does not compile. First of all, you need to declare your variables correctly. You should also use Option Explicit.

    Option Explicit
    
    Dim count As Long
    Dim points As Variant
    Dim i As Long
    Dim user_range As Range
    

    The count and ReDim lines are OK, but you are assuming that the two selections are both the same size. Will that always be the case?

    Then I’m not sure what it is you want to do, but I’m guessing you just want to save the values in user_range into points.

    You need to adress them a bit different:

    points(i, 1) = user_range.Areas(1).Cells(i, 1).Value    'Selection 1
    points(i, 2) = user_range.Areas(2).Cells(i, 1).Value    'Selection 2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following situation... In a certain View, the user must select the
I have a situation where user requests to do a long running process. I
I've got the following situation: A User object has a Set of Permission objects
Here's my situation. I have two tables: pledges and pledge_transactions. When a user makes
I have a situation where I want a user to select a file, then
I am using knockout to build a user interface for the following situation: -
I have situation where a user can manipulate a large set of data (presented
I have situation like this: user submits form with action='/pay' in '/pay' I have
I have a situation in which user can single tap a control, which show
Situation: I am creating a database user interface for a client's website. I know

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.