Shamil Salakhetdinov
shamil at users.mns.ru
Tue Aug 16 15:52:59 CDT 2005
Dan, Both work OK here with MS Excel 2003 when ("Available Items") is active worksheet. I think you need to refactor your code to have: Dim wks As Excel.Worksheet Set wks = Worksheets("Available Items") wks.Select wks.Range(wks.Cells(2, 1), wks.Cells(123, 2)).Select HTH, Shamil -- Web: http://smsconsulting.spb.ru/shamil_s ----- Original Message ----- From: "Dan Waters" <dwaters at usinternet.com> To: "DBA-Tech" <dba-tech at databaseadvisors.com>; "AccessD" <accessd at databaseadvisors.com> Sent: Tuesday, August 16, 2005 6:47 PM Subject: [dba-Tech] 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 > > _______________________________________________ > dba-Tech mailing list > dba-Tech at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-tech > Website: http://www.databaseadvisors.com