Results 1 to 10 of 10

Runtime error 1004 - Application-defined or object-defined error

Threaded View

  1. #1
    Registered User
    Join Date
    10-13-2010
    Location
    Colorado Springs, CO
    MS-Off Ver
    Excel 2010
    Posts
    55

    Runtime error 1004 - Application-defined or object-defined error

    Hi,

    The following code was provided to me last night (thanks a bunch!!), but as I also need to identify which provider is responsible for the different sections that are listed, I have modified the sheets being copied to have the provider's name listed in column A for each row. When I changed the range to incorporate the changes I am now getting the following error:

    Runtime error 1004 - Application-defined or object-defined error.

    The line highlighted by the error is:
     Set rng = rng.Resize(rng.Rows.Count, rng.Columns.Count + 1).Offset(, -1)
    Another issue I have is the merged cells that are in the worksheets being copied. If I use the PasteValues option, I get an error that the merged cells must be the same size. I need to use paste values to pull the doctors name in as column A on the source worksheets has a formula to populate that.

    the code now reads: I have also attached a revised version of the example worksheet
    the code is listed in Module5
    Example Worksheet-3.xlsm

    Sub Billing_CopyIt()
    
        Dim ws As Worksheet
        Dim wsOut As Worksheet: Set wsOut = ThisWorkbook.Sheets("Billing Temp")
        Dim rng As Range
        
        Application.ScreenUpdating = False
        
        For Each ws In ActiveWorkbook.Worksheets
            Select Case ws.Name
                Case Is = "Audit Temp", "Audit Summary", "Billing Temp", "Code_Table", "Master Provider List", "Accuracy Report Group", "Instructions"
                    'do nothing
                Case Else
                    On Error Resume Next
                    Set rng = ws.Range("a23:j37").SpecialCells(2)
                    On Error GoTo 0
                    If Not rng Is Nothing Then
                        Set rng = rng.Resize(rng.Rows.Count, rng.Columns.Count + 1).Offset(, -1)
                        rng.Copy: wsOut.Range("A" & Rows.Count).End(xlUp)(2, 1).PasteSpecial xlPasteAll
                        Set rng = Nothing
                    End If
            End Select
        Next ws
        
        Application.ScreenUpdating = True
        
    End Sub
    Any help is greatly appreciated

    Carole
    Last edited by Leith Ross; 04-14-2014 at 04:06 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Runtime error 1004 - Application Defined or Object Defined Error
    By ljuarez714 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-23-2012, 05:25 PM
  2. Replies: 0
    Last Post: 05-14-2012, 11:59 PM
  3. Runtime error '1004' Application-defined or object-defined error Comment
    By Willer in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-17-2011, 03:02 PM
  4. RE: Runtime error 1004- application defined or object defined erro
    By Novice in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-06-2006, 05:40 PM
  5. [SOLVED] RE: Runtime error 1004- application defined or object defined erro
    By Jim Thomlinson in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-06-2006, 05:35 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1