Results 1 to 10 of 10

Copying all rows that meet a criteria to another worksheet

Threaded View

  1. #1
    Registered User
    Join Date
    08-16-2012
    Location
    Auckland New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    15

    Copying all rows that meet a criteria to another worksheet

    I am trying to copy entire rows that have a value in column A from an entry worksheet - starts at A10 (Sheet1) to the next empty line in a sales record worksheet(Sales), then clear the entry worksheet. I am very new to VBA coding. I also have a hidden column in the entry worksheet with contains a TODAY() Forumla the actual result needs to also be copied - in fact there are a number or formula in the entry worksheet. Both appeared to be working this morning however as I have renamed sheets - and modified the names in the formula while working on other things today I seem to have lost all but the first row when I run the marco. Can any one point out where I am going wrong please: Code as follows:

    Sub CopyRowC()
    
        Dim ws As Worksheet
        Dim r As Range
    
        Set ws = Worksheets("Sales")
        Set r = Range("A10", Range("A65536").End(xlUp))
    
        For Each c In r.Cells
            If c <> "" Then
                c.EntireRow.Copy Destination:=ws.Range("A65536").End(xlUp).Offset(1, 0)
          Cells.Select
    Selection.SpecialCells(xlCellTypeConstants, 1).Select
    Selection.ClearContents
        
       End If
         Next
        MsgBox "Thankyou the sales records have been updated"
        
        
    End Sub
    Sorry if I have posted this wrong - not sure how to load the code differently than this - Like I say I am new at this I bit off a little more than I can chew but need to get the workbook working. Yes I did save three different copies but the error has occured prior to the first save.

    I am sure the answer is staring me in the face -
    Thanks
    Kazza
    Last edited by arlu1201; 08-17-2012 at 04:31 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