Results 1 to 7 of 7

Thread: error 1004 unable to get pastespecial property of range class

  1. #1

    error 1004 unable to get pastespecial property of range class

    hi i have following code it give this error can u pl help how to use paste special hear?

    ws.Range(rTFind.Offset(-1), rBFind.Offset(-2)).EntireRow.Copy _
                    Sheets(sname).Cells(rTitle + 1, "A").PasteSpecial.x1Value

  2. #2
    VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,709
    Location
    Remove the Line Continuation underscore on the first line
    Please take the time to read the Forum FAQ

  3. #3
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,800
    Location
    The second line should also read:
    Sheets(sname).Cells(rTitle + 1, "A").PasteSpecial xlPasteValues
    (note the constant starts with XL and not X1)
    Be as you wish to seem

  4. #4
    i did try that but still giving error
    ws.Range(rTFind.Offset(-1), rBFind.Offset(-2)).EntireRow.Copy
                    Sheets(sname).Cells(rTitle + 1, "A").PasteSpecial xlPastevalues

  5. #5
    snb
    Guest
    Partial information, partial answers,,,,


     
    Sheets(sname).Cells(rTitle + 1, "A").entirerow.resize(2)=rTFind.Offset(-2).resize(2).entirerow.value

  6. #6
    thanks snb here is my do loop

                Do
                    Set rBFind = ws.Range("A:A").FindNext(rTFind)
                    sname = Format(Day(Int(rTFind.Offset(-1))) + 1, "DD")
                    If Not Evaluate("=ISREF('" & sname & "'!A1)") Then    'create sheet if needed
                        Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = sname
                    Else                                                      'clear sheet if it exists
                        Sheets(sname).Move After:=Sheets(Sheets.Count)
                        Sheets(sname).Cells.Clear
                    End If
                    ws.Rows(rTitle).Copy Sheets(sname).Cells(rTitle, "A")
                    If rBFind.Address <> rFirst.Address Then
                    'ws.Range(rTFind.Offset(-1), rBFind.Offset(-2)).EntireRow.Copy _
                    Sheets(sname).Cells(rTitle + 1, "A")'.PasteSpecial 'xlPastevalues
                    ws.Range(rTFind.Offset(-1), rBFind.Offset(-2)).EntireRow.Copy
                    
    
    
                Sheets(sname).Range(Cells(rTitle + 1, "A")).PasteSpecial xlPasteValuesAndNumberFormats
    ''' error 1004 at last line now ""application define or object define error
    loop

  7. #7
    snb
    Guest
    You'd better use autofilter than find...findnext

    Sub M_snb()
       with sheet1.columns(1)
         .autofilter 1, "searchitem"
         for each cl in .specialcells(12)
            if cl.row>1 then
               '   etc
            end if
         next
      end with
    End Sub

Posting Permissions

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