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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:09:10+00:00 2026-05-23T22:09:10+00:00

   I’m currently looking for a more efficient method, via VBA, to get information transferred

  • 0

   I’m currently looking for a more efficient method, via VBA, to get information transferred from a 2-d array within a Sub into a staggered set of ranges within an excel workbook. I’ve distilled what I need into an example below, complete with code; any help will be greatly appreciated.

   I’ve linked images describing an example of what I’m working with (Input, Array, and Output), and written an example of the code that I’m using below. For the sake of simplicity let’s define “Input Sheet” as Sheet1 and “Output Sheet” as Sheet2 within the workbook:

Input Sheet

  Option Explicit

  Sub TransferData()
    Dim myArray as Variant           'Define the array to hold the data.
    Dim i as integer                 'Define a generic loop counter variable.

    myArray = Sheet1.Range("A1:F7")  'Pulls all the relevant data into the array.

    myArray now looks exactly like the range. (I’d post 3rd link, but I need to earn some more rep first).

   I want to transfer the data into my output file so that it looks like this:

Output Sheet

   Here is how I currently approach the situation:

    For i = 1 to ubound(myArray)
      Sheet2.Cells(i,1) = myArray(i,1)
      Sheet2.Cells(i,3) = myArray(i,2)
      Sheet2.Cells(i,6) = myArray(i,3)
      Sheet2.Cells(i,7) = myArray(i,4)
      Sheet2.Cells(i,8) = myArray(i,5)
      Sheet2.Cells(i,9) = myArray(i,6)
    Next i
  End Sub

   My question is this; is there a way to transfer the data from the array to the staggered ranges in a way similar to how I grabbed the array; a range at a time? For example, something along the lines of:

Sheet2.Range("A1:A8") = myArray(1 to 7, 1)  'Note: this is total pseudocode
Sheet2.Range("C1:C8") = myArray(1 to 7, 2)  'Note: this is total pseudocode

etc… etc…

   I believe I’ve managed to teach myself a fair amount of VBA so far, but I definitely don’t know everything, and this is something i need help with. I’m trying to minimize the amount of writes to the worksheets from VBA; they really take their toll.

   Any help is greatly appreciated.

  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-05-23T22:09:12+00:00Added an answer on May 23, 2026 at 10:09 pm

    “Copying and pasting” the values might be quite a bit faster. You’ll obviously need to generalize this to fit your purposes, but this code works with the sample you provided:

    Sub TransferData()
    
        Sheet3.Range("A1:A7") = Sheet1.Range("A1:A7").Value
        Sheet3.Range("C1:C7") = Sheet1.Range("B1:B7").Value
        Sheet3.Range("F1:I7") = Sheet1.Range("C1:F7").Value
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Visual Studio 2005/ C# ClickOnce application that gets all its data from a
I have VB.NET code in Visual Studio 2008 using an obsolete method and would like to
  var mymarkers= []; //array function createMarker(point,html,ref){ var marker = new GMarker(point); mymarkers[ref] =
    All I want to get only All without <ins> When I use
Pre-Honeycomb (Android 3), each Activity was registered to handle button clicks via the onClick tag
Root ---- Array   Item 0- Dictionary     fullName ---- String     address ---- String   Item 1
I have a table: id group data 1  a     10 2  a     20 3  b     10 4  b     20 I want to get ids
Is there a way to have Visual Studio 2008 execute the Publish Now button from the
I really need to work with information contained in WordPerfect 12 files without using WordPerfect's
From Stack Overflow question How to add calendar events in Android? I came to 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.