Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-03-2022, 10:33 AM
Logit Logit is offline Compare 4 Cols - Copy/Paste Row Other Sheet - 1st Empty Row Windows 10 Compare 4 Cols - Copy/Paste Row Other Sheet - 1st Empty Row Office 2007
Expert
Compare 4 Cols - Copy/Paste Row Other Sheet - 1st Empty Row
 
Join Date: Jan 2017
Posts: 529
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default 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.
Reply With Quote
  #2  
Old 10-03-2022, 12:53 PM
Logit Logit is offline Compare 4 Cols - Copy/Paste Row Other Sheet - 1st Empty Row Windows 10 Compare 4 Cols - Copy/Paste Row Other Sheet - 1st Empty Row Office 2007
Expert
Compare 4 Cols - Copy/Paste Row Other Sheet - 1st Empty Row
 
Join Date: Jan 2017
Posts: 529
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

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
Reply With Quote
  #3  
Old 10-04-2022, 07:45 AM
Logit Logit is offline Compare 4 Cols - Copy/Paste Row Other Sheet - 1st Empty Row Windows 10 Compare 4 Cols - Copy/Paste Row Other Sheet - 1st Empty Row Office 2007
Expert
Compare 4 Cols - Copy/Paste Row Other Sheet - 1st Empty Row
 
Join Date: Jan 2017
Posts: 529
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

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.
Reply With Quote
  #4  
Old 10-04-2022, 05:19 PM
Guessed's Avatar
Guessed Guessed is offline Compare 4 Cols - Copy/Paste Row Other Sheet - 1st Empty Row Windows 10 Compare 4 Cols - Copy/Paste Row Other Sheet - 1st Empty Row Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
Reply

Thread Tools
Display Modes


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
Compare 4 Cols - Copy/Paste Row Other Sheet - 1st Empty Row 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

Other Forums: Access Forums

All times are GMT -7. The time now is 11:12 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft