I am struggling with comparing two columns and adding missing values from columns H & I to columns J & K, while keeping the rest of my macro intact if possible.
I have a macro which checks if J & K are empty, and if they are it adds values from H & I.
Sub Total()
Application.ScreenUpdating = False
Dim c As Range
For Each c In Range("J23:J32" & Cells(Rows.Count, "J").End(xlUp).Row)
If c.Value = "" Then c.Value = c.Offset(, -2).Value
Next
For Each c In Range("K23:K32" & Cells(Rows.Count, "K").End(xlUp).Row)
If c.Value = "" Then c.Value = c.Offset(, -2).Value
Next
Application.ScreenUpdating = True
End Sub
I want to add two conditions.
If J is not blank, then compare all of the values from H with values from J and add missing values from J to the end of the list, wherever it might be, and put values from I to K.
For example, if H30 value is missing from column J, I want H30 and I30 to be added to J&K column.If J is not blank, then compare all of the values from H with values from J. If the values match, then SUM the value from column I with value from column K.
For example, if H30 is present anywhere in column J, sum I30 with K30.