[AccessD] OT - Excel VBA Cell Selection Syntax (x-posted)

Hale, Jim Jim.Hale at FleetPride.com
Tue Aug 16 11:43:49 CDT 2005


This function works fine in my test workbook. Is "available items" correct,
ie. no leading or trailing spaces in the name? Also, make sure wsItems is
dimmed as a worksheet not worksheets.
Jim Hale

-----Original Message-----
From: Dan Waters [mailto:dwaters at usinternet.com]
Sent: Tuesday, August 16, 2005 11:14 AM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] OT - Excel VBA Cell Selection Syntax (x-posted)


Hi Jim,

Well - I got the same 1004 (Select Method of Range Class Failed) error.  I
am running from within Excel.

However, when I held the mouse over the wsItems.Cells phrase, intellisense
displayed the value of that cell.  Seems like a step forward but more is
needed.

Dan Waters


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Hale, Jim
Sent: Tuesday, August 16, 2005 10:44 AM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] OT - Excel VBA Cell Selection Syntax (x-posted)

try (runs from within Excel. If you want to run from inside Access you will
need an Excel object)

Function test()
Dim wsItems As Worksheet
Set wsItems = Worksheets("Available Items")
wsItems.Range(wsItems.Cells(2, 1), wsItems.Cells(123, 2)).Select
Set wsItems = Nothing
End Function

Jim Hale

-----Original Message-----
From: Dan Waters [mailto:dwaters at usinternet.com]
Sent: Tuesday, August 16, 2005 9:47 AM
To: DBA-Tech; AccessD
Subject: [AccessD] OT - Excel VBA Cell Selection Syntax (x-posted)


Hello to All,

I'm struggling with syntax for the selection of cells when trying to use row
and column indexes.  Below is an example:

Example A:
    Worksheets("Available Items").Range("A2:B123").Select

Example B:
    Worksheets("Available Items").Range(Cells(2, 1), Cells(123, 2)).Select

Example A works fine, but B does not.  Both are from Excel Help files (see
the Range Property).  Once this works I will substitute a variable for the
123 value.

Thanks!
Dan Waters

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

***********************************************************************
The information transmitted is intended solely for the individual or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or
other use of or taking action in reliance upon this information by
persons or entities other than the intended recipient is prohibited.
If you have received this email in error please contact the sender and
delete the material from any computer. As a recipient of this email,
you are responsible for screening its contents and the contents of any
attachments for the presence of viruses. No liability is accepted for
any damages caused by any virus transmitted by this email.

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

***********************************************************************
The information transmitted is intended solely for the individual or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or
other use of or taking action in reliance upon this information by
persons or entities other than the intended recipient is prohibited.
If you have received this email in error please contact the sender and
delete the material from any computer. As a recipient of this email,
you are responsible for screening its contents and the contents of any
attachments for the presence of viruses. No liability is accepted for
any damages caused by any virus transmitted by this email.


More information about the AccessD mailing list