Results 1 to 21 of 21

Copy and paste non blank rows from a range

Threaded View

  1. #1
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Copy and paste non blank rows from a range

    Hi,

    I need to copy only the rows in a range that have data in them. For a basic explination, with overtime calcs if someone is part time say 20/35 and they do 20 hours overtime.

    The first 15 hours are paid at time and get one GL Code
    The other 5 are time and a half and get a different code.

    On my input sheet this is all calculated and only fills in the relevant line in the table (essentially there are about 12 overtime types)

    The way the form worked originally was that it copied the data from the single input line to the output tab, this one now copies from the new table I've created to the output tab and works fine...


    However it copies the whole range of the table "I6:P18" and includes blank lines on the output table. How can I get it so it only copies lines out of that range that aren't blank?

    This is the current copy code I am using:


    Private Sub CommandButton2_Click()
    Dim NR As Long
    Dim InS As Worksheet
    Dim OuS As Worksheet
    
    Set InS = Sheets("INPUT LIST")
    Set OuS = Sheets("OUTPUT LIST")
    NR = OuS.Range("A" & Rows.Count).End(xlUp).Row + 1
    
    InS.Range("I6:P18").Copy
    OuS.Range("A" & NR).PasteSpecial xlPasteValues
    
    Range("Emp,Manual,Role,OHrs,SHrs,Casual,CRate,AddType,AddHrs,FDate,TDate").Value = ""
    End Sub
    Last edited by mcinnes01; 10-12-2010 at 09:40 AM.

Thread Information

Users Browsing this Thread

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

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