In my code the copy values line does not work:
Worksheets("Journal").Range("E7").Value = Worksheets("Allocation %").Range("B7").Value
I don't now why? I really just want the value in col B to be copied in "Journals" starting at E7. Currently only E7 has a value when the macro is run. Possibly a problem with my ranges?
Private Sub PrepareJournal()
Dim LastCol As Long, x As Long, i As Long
Dim LastRow As Long
Dim rng As Range
Application.ScreenUpdating = False
With Worksheets("Journal")
Rows("7:" & Rows.Count).ClearContents
End With
With Worksheets("Volume Allocation")
LastCol = .Cells(7, .Columns.Count).End(xlToLeft).Column
x = 1
For i = 5 To LastCol
If .Cells(7, i).Value <> 0 Then
Sheets("Journal").Cells(x, "D").Value = .Cells(8, i).Value
x = x + 16
End If
Next i
End With
With Worksheets("Allocation %")
Set rng = .Range("C7:C34")
LastRow = .Range(Split(.Cells(, rng.Column).Address, "$")(1) & (rng.Row + rng.Rows.Count)).End(xlUp).Row
For i = 1 To LastRow
If .Cells(1, i).Value <> 0 Then
Worksheets("Journal").Range("E7").Value = Worksheets("Allocation %").Range("B7").Value
End If
Next i
End With
Application.ScreenUpdating = True
End Sub