Hello!
I am struggling with comparing two columns and adding missing values from H&I to J&K, while keeping the rest of my macro intact.
So far I have a macro which checks if J&K are empty, and if they are empty it adds values from H&I to them, see below:
I want to add two additional conditions:
Columns A:G are irrelevant under the circumstances.
Clear macro is as follows:
Thank you very much in advance!!
Cheers
I am struggling with comparing two columns and adding missing values from H&I to J&K, while keeping the rest of my macro intact.
So far I have a macro which checks if J&K are empty, and if they are empty it adds values from H&I to them, see below:
VBA Code:
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 additional conditions:
- If J is not blank, then compare all of the values from H with values from J and add missing values to J to the end of the list, wherever it might be, and put values from I from to K.
- If J is not blank, then compare all of the values from H with values from J, and if the values match, then SUM the value from column I with value from column K.
Columns A:G are irrelevant under the circumstances.
Clear macro is as follows:
VBA Code:
Sub ClearContents()
Range("J23", "K53").ClearContents
End Sub
Thank you very much in advance!!
Cheers