#1
|
|||
|
|||
Compare 4 Cols - Copy/Paste Row Other Sheet - 1st Empty Row
Using VBA Macro : How to compare columns K:N. If same dollar value of "0.00" then entire row copy / paste other sheet 1st empty row.
Thanks. |
#2
|
|||
|
|||
Here are two attempts that failed :
Code:
Sub Names() Dim Cell As Range Dim NextRow As Variant Dim lrA As Long ', lrD As Long Dim i As Long, j As Long, x As Long Application.ScreenUpdating = False lrA = Range("K" & Rows.Count).End(xlUp).Row NextRow = Sheet3.Cells(Rows.Count, 1).End(xlUp).Row + 1 For i = 7 To lrA If Range("K" & i).Resize("N" & i).Value = "0.00" Then Range("K" & i).EntireRow.Copy Destination:=NextRow End If i = i + 1 Next i Application.ScreenUpdating = True 'MsgBox "completed" End Sub Sub copy_rows() Dim i As Long i = Sheet1.Range("A" & Rows.Count).End(xlUp).Row For i = 7 To i If Cells(i, 11) = "0.00" And Cells(i, 12) = "0.00" And Cells(i, 13) = "0.00" And Cells(i, 14) = "0.00" Then Cells(i, 11).EntireRow.Copy Sheet3.Cells(Rows.Count, 1).End(xlUp).Row + 1 End If Next i End Sub |
#3
|
|||
|
|||
Ok ... no responses so far. I need to better explain what is occurring ? Please ask
me what it is you need to know, in order to assist. |
#4
|
||||
|
||||
Post a sample workbook which demonstrates the type of content that the code needs to work on. Also explain the difference between 0 and 0.00 - is the formatting of the number as a string relevant to whether the row gets deleted?
If you want a copy of a worksheet that deletes any rows which include zero values in four columns then this logically would be cleaner to do by replicating the worksheet and removing the rows you don't want. This will allow you to preserve row and column heights and be simpler to code IMO.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
VBA Code to copy data from two sheet ,paste into corresponding sheet through cmdbutton | jackfruit88 | Excel Programming | 1 | 07-08-2022 09:27 PM |
copy paste of pst sees address book empty , why ? | DBenz | Outlook | 1 | 05-30-2019 10:21 PM |
copy a row and paste the row into another sheet more then one time:macro | waqar1239 | Excel Programming | 1 | 04-07-2017 09:57 AM |
How to copy excel sheet withe HEADER and Paste into new sheet? | cloudforgiven | Excel Programming | 6 | 01-05-2017 07:30 PM |
copy checkbox string and paste it in excel sheet | MOHAMMEDSALMAN | Excel Programming | 7 | 10-29-2015 03:50 AM |