Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    173

    Unanswered: Copy a range from one sheet to another

    Why doesn't the following work

    Public Sub test()
    Dim rng As Range, rng2 As Range
    Set rng = Range("d_21")
    Set rng2 = Range("div_21")
    rng.Copy
    rng2.PasteSpecial xlPasteAll
    End Sub

    I get a runtime error 1004. Application defined or object defined error. What gives. All I need to do is paste the range d_21 to div_21. Any ideas appreciated.

  2. #2
    Join Date
    Jan 2004
    Location
    Aberdeen, Scotland
    Posts
    1,067
    try fully qualifying your references
    i.e.
    worksheets("Sheet1").Range("div_21").Formula = Worksheets("Sheet2").Range("d_21").Fomula

    another possibility is that excel is not picking up your named ranges try using the actual cell references

    all the best
    Dave

Posting Permissions

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