Solved

Excel VBA Range and Cells

Posted on 2013-11-26
2
287 Views
Last Modified: 2013-11-26
I have this same problem all the time, and can never remember the solution. Here is the code:

cc = 22
writewrk.Sheets("Characteristics").Range("A20:A48").Value = readwrk.Sheets("Weights").Range("B17:B45").Value
writewrk.Sheets("Characteristics").Range("B20:B48").Value = readwrk.Sheets("Weights").Range(Cells(17, cc), Cells(45, cc)).Value

Open in new window


Line 2 works, but line 3 gives an error. Why is this? What is the correct syntax? Thanks.
0
Comment
Question by:sypder
2 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 39679372
I think you ought to have

readwrk.Sheets("Weights").

before each of the cells()
0
 
LVL 3

Author Comment

by:sypder
ID: 39679424
You are exactly right! So simple, yet so hard for me to remember. Thanks.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Batch file or script with password 22 44
conditional formatting 4 42
Excel VBA - triggering a Sheet event on another workbook 3 29
formatting - number format 2 14
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

777 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