LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Cannot read selected row

I am using Excel 2000 with sp3.

I am attempting to run code from the current workbook and open a second
instance of Excel, add a new workbook, paste in data from a recordset from an
Access database.

All works well until I attempt to read the row for thencurrently selected
cell and store to a variable.

Here is my code:
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
Set oSheet = oBook.Worksheets(1)
oSheet.Activate
'next line adds data from open recordset - works well
oSheet.Range("A1").CopyFromRecordset myrs
oSheet.Range("A1").Select
oSheet.Range("A1").End(xlDown).Select
'next line reads row from last active worksheet of workbook where code
'is running from, not from the new workbook
MyEnd = Selection.Row

Any help is appreciated.
--
HTH

Mr B
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i make it so that when a sheat is selected either via link or tab, that xlLastCell is selected. the last on the sheet. Daniel Excel Worksheet Functions 1 July 12th 05 01:30 AM
how read value from last selected cell? It is possible? how get adress last selected cell? Andrzej New Users to Excel 4 May 30th 05 07:28 PM
how read value from last selected cell? It is possible? how get adress last selected cell? Andrzej Excel Programming 1 May 30th 05 06:18 PM
Can VBA read the row-col location of a selected cell? news.bcentral.com Excel Programming 2 January 19th 05 06:01 PM


All times are GMT +1. The time now is 12:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"