Results 1 to 3 of 3

Thread: Range objects

  1. #1
    Join Date
    Feb 2004
    Location
    Charlotte, NC
    Posts
    79

    Unhappy Unanswered: 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...

  2. #2
    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

  3. #3
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •