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

Hale, Jim Jim.Hale at FleetPride.com
Tue Aug 16 10:44:29 CDT 2005


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.


More information about the AccessD mailing list