I'm VERY new to VBA, like, this is my first time trying to use it new. I have a sheet in excel (called Fedex) that is auto populated from a different sheet (invoice). I would like to copy entire rows from the fedex sheet that have a nonzero value in column A, such that in the new sheet I have a simple table of all items that have nonzero quantities. I have a module that is currently just copying the entire list into a new sheet, 0 rows included. Can someone please help me??
This is what I have currently (mostly just a copy from something online with some edits I tried to add to get it working):
Sub cpynpst() Dim sh4 As Worksheet, sh5 As Worksheet, lr As Long, rng As Range Set sh4 = Sheets("Fedex") Set sh5 = Sheets("Sheet2") For Each rng In sh4("A2:A") If rng.Value <> 0 Then lr = sh4.Cells(Rows.Count, 1).End(xlUp).Row Set rng = sh4.Range("A2:A" & lr) rng.EntireRow.Copy sh5.Cells(Rows.Count, 1).End(xlUp)(2) End If Next rng End Sub