Sabtu, 13 Oktober 2012

Re: [ExcelVBA] Abbreviations to Words

 

There is no history left on this message, so I don't have the context ...
but anyway ...

> nF = Range("Fruit")

If the above is an actual statement, then "nF" does not get a named range:
it gets the value of the area named by the range.

To set a variable to a named range, you need to use the Set keyword on your
statement.

How is nF declared? If you want it to be a range, then it should have

Dim nF As Range

to declare it. If it is to be a string value, then probably

Dim nF As String

Doing this should get the compiler or runtime to tell you when you've gone
astray.

(Same would apply to nA, of course.)

Hmmm ....

Then you use nF with Cells(nrow, nF). Now a Cells() call takes two
parameters, and the second must either be the number of the column you want,
or its letter ("A", "B", etc).

What exactly is nF supposed to be, and what is actually in the area defined
by Range("Fruit")?

Regards, Dave S

----- Original Message -----
From: "Michael Trombetta" <mickey11030@yahoo.com>
To: <ExcelVBA@yahoogroups.com>
Sent: Sunday, October 14, 2012 5:39 AM
Subject: Re: [ExcelVBA] Abbreviations to Words

Hi Derek,

Thanks for being so patient with my slow learning process.

When I wrote

nF = Range("Fruit")
nA = Range("Abb")
nrow = 3
Cells(nrow, nF).Value = clxFruit.Item("key" & Cells(nrow, nA).Value)

I was not trying to fill all of the named range nF. I had done some
experiments that convinced me that Cells(nrow, nF) referred to a particular
cell. That is, if nF refers to Col P, and nrow is 3, the reference is to
Cell P3.

Scratch That! I just realized that in my experiment, the named ranges I used
were single cells. I created a named range nPay that referred to a cell with
a value of 9 and nHours to a cell with a value of 30. The statement
Cells(13,3) = nPay * nHours worked, and that convinced me (incorrectly) that
Cells(nrow, nA) would also work. Enlightenment. Better late than never.

You mentions that processing could be speeded up if arrays were used, so
that all the processing was done within VBA. You said you had discussed that
in an earlier post. I'd appreciate your pointing me to that post.

Thank you for showing me the 4 ways of using Cells. That will be very
useful.

Regards,
Michael Trombetta

[Non-text portions of this message have been removed]

------------------------------------

----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go
here: http://www.mousetrax.com/techtrax to enter the ezine, then search the
ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------Yahoo! Groups Links

-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1427 / Virus Database: 2441/5328 - Release Date: 10/12/12

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (15)
Recent Activity:
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------
.

__,_._,___

Tidak ada komentar:

Posting Komentar