I am trying to loop through all cells in a row (row 7 starting at column E to last used column) and copying the value in the cell below (row 8) if cell in row 7 does not equal zero.
I am not sure if I've written the code correctly for this. Would appreciate any advice.
I am not sure if I've written the code correctly for this. Would appreciate any advice.
Code:
Sub SummarizeData() Dim LastCol As Integer
Rows("2:" & Rows.Count).ClearContents
Worksheets("Volume Allocation").Activate
With ActiveSheet
LastCol = .Cells(7, .Columns.Count).End(xlToLeft).Column
End With
For i = 7 To LastCol
If Worksheet.Cells(7, i).Value <> 0 Then
ActiveSheet.Cells.Range("8:i").Value.Copy Destination:=Sheets("Journal").Range("A1")
PasteSpecial Paste:=xlPasteValues, Transpose:=True
End If
Next i
End Sub