So I have been beating my head against this for a couple of days now. If column R is blank, exclude or ignore that entire record from the code. The problem is, I can get it to work.... if I permentantly delete that row from the sheet. The entire code is very very long so I will only include the necessary parts. Thank you!
P.S: "Remedy" in myarray is that column R that was referenced earlier.
P.S: "Remedy" in myarray is that column R that was referenced earlier.
VBA Code:
'Sets Array from "Make-Ready" Sheet
Sheets("Make-Ready").Select
Range("A1").Select
Dim CountRow As Integer
Dim CountColumn As Integer
Dim i As Integer
Dim myarray() As Variant
lastrow = (Range("A19:A500").SpecialCells(xlCellTypeConstants, xlNumbers).Count) + 19 'This line get the total number of rows
lastcolumn = Range("A19").End(xlToRight).Column 'This line get the total number of columns
lastcolumn = lastcolumn + 1 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' FIX THIS LATER - ARRAY IS STOPPING 1 COLUMN SHORT
ReDim Preserve myarray(1 To lastrow, 1 To lastcolumn) 'Define the size of array
'Nested "For Loop" fills myarray with values from selected sheet
For CountRow = 20 To lastrow
For CountColumn = 1 To lastcolumn
myarray(CountRow, CountColumn) = ActiveCell.Offset((CountRow - 1), (CountColumn - 1))
Next CountColumn
Next CountRow
For i = 20 To lastrow
If myarray(i, Remedy) = "" Then ' guessing this looks for FINAL remedy and if empty uses ENG remedy
ActiveCell.Offset(1, 0).Value = myarray(i, Remedy - 1)
Else
ActiveCell.Offset(1, 0).Value = myarray(i, Remedy)
End If