Minggu, 14 Oktober 2012

Re: [ExcelVBA] Abbreviations to Words

 

> Actually, it seems to me that I'm not asking Excel to do anything
> special. If it can understand Cells(nrow, "E") means E3 ...

No, it doesn't understand any of this. What happens is that the Cells()
built-in function is called with the two parameters nrow and "E". The
Cells() function ... despite its name being plural ... returns one cell
only.

In essence, the two parameters to a Cells() function call are row number and
column number. However, it will also accept column letter to allow the code
to be a bit more readable.

If you want to work on multiple cells at once, then you need to use ranges
(e.g. "E2:E6") and probably the Range() built-in function, which can handle
more than one cell. But remember that not all activities in VBA can work on
multiple cells: some only work on one at a time.

Regards, Dave S

PS Please don't trim all of the previous message thread off your replies.
You need to retain some of the previous thread, so we can see what the
latest messages are referring to.

----- Original Message -----
From: "Michael Trombetta" <mickey11030@yahoo.com>
To: <ExcelVBA@yahoogroups.com>
Sent: Monday, October 15, 2012 7:09 AM
Subject: Re: [ExcelVBA] Abbreviations to Words

Hi David,

Here is what I did. I defined nF as simply Dim nF, (although when I just now
changed the program to Dim nF as Range, I got the same error). Fruit is the
name I assigned in Excel to E2:E6. Also changing the statement to Set nF =
Range("Fruit") doesn't eliminate the error.

You say, "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)."
I naively assumed that Cells(nrow, nF) (where I previously gave nrow the
value 3), would mean the cell in row 3 in the range E2:E6, that is, E3. but
I see it doesn't.

Actually, it seems to me that I'm not asking Excel to do anything special.
If it can understand Cells(nrow, "E") means E3, where it picks out the cell
I want from the whole column, it should be able to understand Cells (nrow,
E2:E6) also means E3!

With Fruit a defined name on a sheet, and nF defined by Dim nF as Range,
what value does the statement Set nF = Range("Fruit") assign to nF?

Thanks for your help,
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/5330 - Release Date: 10/13/12

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (17)
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