Solved

Excel VBA Range and Cells

Posted on 2013-11-26
2
264 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

705 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now