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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:08:55+00:00 2026-06-06T13:08:55+00:00

The following works great (thanks to gracious assistance by this community!) Function RangeToArrayToRange(inputRange as

  • 0

The following works great (thanks to gracious assistance by this community!)

    Function RangeToArrayToRange(inputRange as Range) As Variant
            Dim inputArray As Variant
            inputArray = inputRange
            RangeToArrayToRange = inputArray
    End Function

This function will copy an input range to an output perfectly. However, when I do some operations on the inputArray, the arrays look perfect but in Excel, only the first value of the array prints to all the cells. In this example, I’m parsing out a number from some input strings.

Input Range:

ABC=1X:2Y 
ABCD=10X:20Y
ABCDE=100X:200Y

Code:

    Function RangeToArrayToRange(inputRange As Range) As Variant

        Dim inputHeight As Integer
        inputHeight = inputRange.Count

        Dim inputArray As Variant
        inputArray = inputRange

        Dim strippedArray() As Variant
        ReDim strippedArray(1 To inputHeight)

        Dim currentInput As String
        Dim currentInputAsInt As Integer
        Dim i As Integer

        For i = 1 To inputHeight

            currentInput = inputArray(i, 1)
            currentInput = Right(currentInput, (Len(currentInput) - Application.WorksheetFunction.Find("=", currentInput))) 
            'splits out everything left of the "="
            currentInput = Right(currentInput, (Len(currentInput) - Application.WorksheetFunction.Find(":", currentInput)))
            'splits out everything to the right of the ":"
            currentInput = Left(currentInput, Len(currentInput) - 1) 
            'split out the letter to allow int casting
            currentInputAsInt = CInt(currentInput)
            'cast to int
            strippedArray(i) = currentInputAsInt
            'saved

        Next i

        RangeToArrayToRange = strippedArray
    End Function

Expected output:

1
10
100

Actual output:

1
1
1

Running through with the debugger, strippedArray contains the Variant/Integer values 1,10,100 at the locations strippedArray(1)/(2)/(3) respectively. The issue is that the range that I array enter in Excel only contains strippedArray(1) as far as I can tell.

Thank you!

  • 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-06T13:08:56+00:00Added an answer on June 6, 2026 at 1:08 pm

    Your strippedArray array, needs to be two dimensional if you are outputting back into an Excel worksheet / range (I’ve made the assumption you are running this as an array formula). Make the following changes:

    ReDim strippedArray(1 To inputHeight, 1 To 1)
    ...
    strippedArray(i, 1) = currentInputAsInt
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently using the following jQuery plugin: jQuery OEmbed. This plugin works great in
I have the following function which works great, i used JSONP to overcome cross-domain,
I am using the following script posted on this site: http://www.javascriptkit.com/script/...oundlink.shtml It works great,
I am using the following which works great. I am just wondering if it
I've implemented the following code on the site I'm working on which works great,
I have the following code running on my Android device. It works great and
I'm trying to execute the following line: exit | sqlplus username/password@sid @test.sql Works great
I have the following RewriteRule: RewriteRule ^/people/([A-Za-z0-9\-\_]*)/?$ /people/people_details.cfm?person=$1 [I,L] ...it works great for forwarding
I have the following rewrite set up: RewriteRule r/(.*) scripts/report.php?cp=1&id=$1 It works great to
I have the following query I use and it works great: SELECT * FROM

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.