Results 1 to 5 of 5

Need to modify code to skip blank rows and headings

Threaded View

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

    Need to modify code to skip blank rows and headings

    Hi,

    I need to modify this code so that it will skip the headings as well as the blank rows below the headings.

    Sub Billing()
    
        Dim Data    As Variant
        Dim DstWks  As Worksheet
        Dim LastRow As Long
        Dim n       As Long
        Dim NextRow As Long
        Dim SrcRng  As Range
        Dim SrcWks  As Worksheet
    
            'UnProtectall
            
            Set DstWks = ThisWorkbook.Sheets("Billing Summary")
            
                NextRow = DstWks.Cells(Rows.Count, "A").End(xlUp).Row
                NextRow = IIf(NextRow < 3, 3, NextRow + 1)
                
                For Each SrcWks In ThisWorkbook.Worksheets
                    Select Case SrcWks.Name
                        Case "Audit Summary", "Accuracy Report Group", "Master Provider List", "Instructions", "Billing Temp", "Audit Temp", "Code_Table", "Billing Summary"
                            ' Skip these worksheets
                        Case Else
                            Set SrcRng = SrcWks.Range("A20:i90")
                              LastRow = SrcRng.Cells(SrcRng.Rows.Count, SrcRng.Column + 1).End(xlUp).Row
                            Set SrcRng = SrcRng.Resize(RowSize:=LastRow - SrcRng.Row + 1)
                            
                            ReDim Data(1 To SrcRng.Rows.Count, 1 To 10)
                    
                                For n = 1 To SrcRng.Rows.Count
                                    Data(n, 1) = SrcWks.Range("c4")
                                    Data(n, 2) = SrcRng.Item(n, 2)
                                    Data(n, 3) = SrcRng.Item(n, 3)
                                    'Data(n, 4) = Empty
                                    Data(n, 4) = SrcRng.Item(n, 4)
                                    Data(n, 5) = SrcRng.Item(n, 5)
                                    Data(n, 6) = SrcRng.Item(n, 6)
                                    Data(n, 7) = SrcRng.Item(n, 7)
                                    Data(n, 8) = Empty
                                    Data(n, 9) = SrcRng.Item(n, 9)
                                Next n
                                
                            DstWks.Cells(NextRow, "A").Resize(n - 1, UBound(Data, 2)).Value = Data
                            NextRow = NextRow + n - 1
                    End Select
                    
                    
                Next SrcWks
                
            'ProtectAll
            
    End Sub
    I have attached a workbook Working copy of Billing Summary.xlsmto show how the data is setup. Currently it includes the headings (Office/Outpatient, Hospital and Re-Audit) with all the data below those headings for each of the physicians, however, I need it to skip those headings and the blank rows below them and only extract actual data.

    thanks for the help

    Missit
    Last edited by JBeaucaire; 02-06-2015 at 10:37 AM. Reason: Merged threads

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Need to add skip blank cells to my code
    By Garbology in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 02-12-2014, 03:45 AM
  2. Need help to make VBA to skip rows that are blank
    By vnzerem in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-11-2013, 05:55 PM
  3. [SOLVED] Skip Section of Code if Filter Returns a Blank
    By tamiso2311 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-11-2013, 12:53 AM
  4. Skip Blank rows
    By Bmxerdude2087 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2012, 11:09 PM
  5. skip blank rows when pasting formulas
    By Newsgal in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 04:05 AM

Tags for this Thread

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