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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:41:53+00:00 2026-06-18T12:41:53+00:00

Using Excel (2010) VBA, I am trying to copy (pass) a constant range of

  • 0

Using Excel (2010) VBA, I am trying to copy (pass) a constant range of cells (whose values recalculate) to an array. Then I am trying to pass that array to a new range of cells, directly below it. After I have done this, I want to again copy (pass) the constant range’s new values to the array, and pass these new values to a range directly below the one I previously passed.

I know this code is atrocious (I am new to arrays in VBA).

Sub ARRAYER()

Dim anARRAY(5) As Variant

Number_of_Sims = 10

For i = 1 To Number_of_Sims
   anARRAY = Range("C4:G4")
   Range("C4").Select
   ActiveCell.Offset(Number_of_Sims, 0).Select
   ActiveCell = anARRAY
   Range("C4").Select
Next

End Sub

I sure do appreciate your help!

Thank you.

Respectfully,

Jonathan

  • 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-18T12:41:55+00:00Added an answer on June 18, 2026 at 12:41 pm

    You are off slightly on a few things here, so hopefully the following helps.

    Firstly, you don’t need to select ranges to access their properties, you can just specify their address etc. Secondly, unless you are manipulating the values within the range, you don’t actually need to set them to a variant. If you do want to manipulate the values, you can leave out the bounds of the array as it will be set when you define the range.

    It’s also good practice to use Option Explicit at the top of your modules to force variable declaration.

    The following will do what you are after:

    Sub ARRAYER()
        Dim Number_of_Sims As Integer, i As Integer
    
        Number_of_Sims = 10
    
        For i = 1 To Number_of_Sims
           'Do your calculation here to update C4 to G4
           Range(Cells(4 + i, "C"), Cells(4 + i, "G")).Value = Range("C4:G4").Value
        Next
    End Sub
    

    If you do want to manipulate the values within the array then do this:

    Sub ARRAYER()
        Dim Number_of_Sims As Integer, i As Integer
        Dim anARRAY as Variant
    
        Number_of_Sims = 10
    
        For i = 1 To Number_of_Sims
           'Do your calculation here to update C4 to G4
           anARRAY= Range("C4:G4").Value
    
           'You can loop through the array and manipulate it here
    
           Range(Cells(4 + i, "C"), Cells(4 + i, "G")).Value = anARRAY
        Next
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to open the Excel file using VBA in Powerpoint 2010 with the
In VBA (Excel 2010), I am dynamically creating a named range list using that
For the record, I'm using Excel 2010. I'm trying to teach myself VBA for
I'm using this web scraping VBA code in Excel 2010 to pull the title
I am using VBA for Excel 2010 and randomly receiving the following error: Run-time
I'm using xmlhttp via vba in excel 2010. I need to programmatically add an
Im looking for a way to do this in Excel 2010 using VBA. It
If I create an Outlook 2010 object In Excel VBA using Sub CreateOL() On
I'm using Excel 2010. I'm trying so save my excel file, with this code.
How to get the current workbook file creation date using VBA in excel 2010?

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.