Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

error vba

Posted on 2016-08-02
3
Medium Priority
?
53 Views
Last Modified: 2016-08-22
Hi Experts,

PFB my code. I am getting an error on  Range(Sheets("simulations").Cells(2, ctr)).Value = Sheets("Model").Range("AP42:AP1041").Value.

Please suggest.

Thanks


Sub loopThrough()
Dim i, j, ctr As Integer
Dim r(0 To 4, 0 To 4) As Long
Dim r2(0 To 4, 0 To 4) As Long

ctr = 1
For i = 0 To 4
    For j = 0 To 4
    Range("Run").Value = ctr
    Calculate
     Src = Sheets("Model").Range("AP42:AP1041").Value
    Range(Sheets("simulations").Cells(2, ctr)).Value = Sheets("Model").Range("AP42:AP1041").Value
    r(i, j) = Range("c").Value
    r2(i, j) = Range("s").Value
    ctr = ctr + 1
    Next j
Next i

End Sub

Open in new window

0
Comment
Question by:camper12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 2000 total points (awarded by participants)
ID: 41739995
You are assigning a multiple cell array to a single cell which does not seem right

Meanwhile try
Sheets("simulations").Cells(2, ctr).Value = Sheets("Model").Range("AP42:AP1041").Value
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41764171
No follow up by the asker
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question