Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Cells V Range

Hi

I have an interesting problem. I am populating an Excel
template from an Access database using
..Range(.Cells(8, 9), .Cells(8, 10)).select
..Range(.Cells(8, 9), .Cells(8, 10)).CopyFromRecordset rs

All appears to work fine. When I open the Excel sheet, it
doesn't seem like any of the data has been populated. BUT
if I go to my immediate window, then cells(8,9) shows me
the value that should have been pasted in, but range("L9")
shows me the old value that should have been overwritten

I was under the impression that Cells and Range were a
synonymous way of refering to the same thing???

Any help would be appreciated.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Cells V Range


Don't select or activate the range...

set WS = Worksheets(somesheetnameornumber)
With WS

..Cells(8, 9).CopyFromRecordset rs

End With

---- assuming that there are records in the RS!!

and yes, you can also use
..Range("L8").CopyFromRecordset rs


You are correct Range and cells are sysnonymous
Range(Range("B2"),Range("E7"))
Range(Range("B2"),cells(7,"E"))
Range(Range("B2"),cells(7,5))
Range(Cells(2,2),cells(7,"E"))
Range(cells(7,"E"),Range("B2"))

Patrick Molloy
Microsoft Excel MVP



-----Original Message-----
Hi

I have an interesting problem. I am populating an Excel
template from an Access database using
..Range(.Cells(8, 9), .Cells(8, 10)).select
..Range(.Cells(8, 9), .Cells(8, 10)).CopyFromRecordset rs

All appears to work fine. When I open the Excel sheet,

it
doesn't seem like any of the data has been populated.

BUT
if I go to my immediate window, then cells(8,9) shows me
the value that should have been pasted in, but range

("L9")
shows me the old value that should have been overwritten

I was under the impression that Cells and Range were a
synonymous way of refering to the same thing???

Any help would be appreciated.


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 473
Default Cells V Range

Cj wrote:
if I go to my immediate window, then cells(8,9) shows me
the value that should have been pasted in, but range("L9")
shows me the old value that should have been overwritten


Cells(8, 9) is cell "I8" - row 8, column 9
Not surprising that L9 was not changed!

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Cells V Range

Patrick Molloy wrote

You are correct Range and cells are sysnonymous
Range(Range("B2"),Range("E7"))


OT, but can I reference this one this way?
Range("B2,E7")

--
David
Reply
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
Summing a range of cells based on criteria in another range Jack Excel Worksheet Functions 2 November 5th 09 01:46 AM
When entering data into a range of cells, select the entire range. Q Excel Discussion (Misc queries) 0 September 26th 07 04:36 AM
how to compute a range of cells based on another range of cells? HAROLD Excel Worksheet Functions 1 December 30th 05 09:32 PM
how to compute a range of cells based on another range of cells? HAROLD Excel Worksheet Functions 2 December 30th 05 07:55 PM
Count cells in one range based on parameters in another range dave roth Excel Worksheet Functions 2 March 29th 05 05:33 PM


All times are GMT +1. The time now is 10:34 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"