If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Range objects

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-19-04, 16:35
robojam robojam is offline
Registered User
 
Join Date: Feb 2004
Location: Charlotte, NC
Posts: 79
Unhappy Range objects

Hi

Can anyone see why this fails with this error:

Run-time error '1004': Method 'range' of object '_Worksheet' failed.

when I try to run this code:

Code:
            wstTarget.Range(rTarget).Value = _
                wstSheet.Cells(iRow, 4).Value
when both rTarget is a properly initialized range object and iRow is a properly initialized integer?

Thanks
__________________
Make something idiot proof and someone will make a better idiot...
Reply With Quote
  #2 (permalink)  
Old 08-19-04, 21:20
savbill savbill is offline
Registered User
 
Join Date: Feb 2004
Posts: 533
wstTarget.Range(rTarget).Value = _
wstSheet.Cells(iRow, 4).Value

You didn't provide any detail of how 'rTarget' is defined. Having a multi cell 'rTarget' range object would mess up the recipe.

Did you define 'rTarget' as a range or a String? It would have to be a String Value for that application?
__________________
~

Bill
Reply With Quote
  #3 (permalink)  
Old 08-20-04, 09:17
MikeTheBike MikeTheBike is offline
Registered User
 
Join Date: Apr 2004
Location: Derbyshire, UK
Posts: 714
Hi again

Looking at your previous post where rTarget is a range object then the code here should be

wstTarget.Range(rTarget.Address).Value = _
wstSheet.Cells(iRow, 4).Value

Then Range() need the cell address as sstring, not an object!!

MTB
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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