Excel

TheSmallman.com

an XL ideas Lab

Dashboards VBA
  • Home
  • Dashboards
    • Tips & Tricks
    • Charts
    • Modelling
    • Infographics
    • VBA
  • Shop Dashboards
    • Power Pivot a User Guide
    • Excel Dashboard Course
    • Advanced Dashboard Course
    • Financial Modelling Course
    • Excel VBA Course
  • Blog
  • About
Menu

Excel Dashboards VBA

Street Address
City, State, Zip
Phone Number
an XL ideas Lab

Your Custom Text Here

Excel Dashboards VBA

  • Home
  • Dashboards
  • Excel Tips
    • Tips & Tricks
    • Charts
    • Modelling
    • Infographics
    • VBA
  • Shop Dashboards
  • PowerPivot
    • Power Pivot a User Guide
  • Courses
    • Excel Dashboard Course
    • Advanced Dashboard Course
    • Financial Modelling Course
    • Excel VBA Course
  • Blog
  • About

Transfer Data Between Arrays with VBA

May 12, 2020 Marcus Small
Transfer between array vba

The purpose of this article is to show you how to move data from one array to another array and output that data to another place. There are other ways to do this and you can surely fill your boots in this article

Move Array

However, this is how to move data out of Excel, into memory and back into cells with the use of a second array.

The following YouTube tutorial takes you through the process. It is a short video that goes through the process line by line. The following is the file to go with the video.

Arrays.xlsm

The goal of the procedure is not to move the entire array but to move part of the array. In our example we will move columns, 2, 8 and 19 and only these columns will be stored in the second array. In this way filtering out a lot of the unnecessary data in the first array.

The following is the procedure from moving data from the array (ar) to the array (var).


Sub MoveArray()
Dim ar As Variant
Dim var As Variant
Dim arr As Variant
Dim i As Long
Dim j As Long

arr = [{2,8,19}]
ar = Sheet2.[a1].CurrentRegion
ReDim var(1 To UBound(ar), 1 To UBound(arr))

    For i = 1 To UBound(ar)
        For j = 1 To UBound(arr)
            var(i, j) = ar(i, arr(j))
        Next j
    Next i
Sheet3.[a1].Resize(UBound(var), UBound(arr)) = var

End Sub
Tags Excel, Array, Transfer, data
← Connect Slicer to Multiple Data SourcesChecking if Folder Exists with VBA →

Featured Posts

Excel Dashboards: Tracking a Crisis

Excel Dashboards: Tracking a Crisis
April 14, 2020

Recent Posts

Populating an Excel Table from a Range of Cells with VBA

Populating an Excel Table from a Range of Cells with VBA June 12, 2025

Fuzzy Distribution with Randbetween

Fuzzy Distribution with Randbetween May 21, 2025

Add Minimum and Maximum for Chart in Cells

Add Minimum and Maximum for Chart in Cells March 12, 2025

Inflation Over Multiple Years in a Single Cell

Inflation Over Multiple Years in a Single Cell January 10, 2025

Hubspot Dashboard

Hubspot Dashboard October 3, 2024

Monthly Dashboard With Supporting Metrics

Monthly Dashboard With Supporting Metrics September 25, 2024

Excel Show Missing Sheet Tabs

Excel Show Missing Sheet Tabs July 29, 2024

Run Macro Overnight Automatically

Run Macro Overnight Automatically June 24, 2024

Split File into Parts and Save to Directory

Split File into Parts and Save to Directory April 20, 2024

Most Popular Author

Most Popular Author December 14, 2023

 

Follow US:

 
 

MarcusSmall@thesmallman.com

 

TheSmallman.com - Making your small systems hum...
© Copyright 2013-2024 theSmallman.com All Rights Reserved.