I want to select cells on a range based on a value just like (ctrl + mouse click)
If the values of column G contains the word Wage and Sum it will be selected. In the picture's case, 5/15 WAGES SUMMARY and 4/15 WAGES SUMMARY will be selected.
If the count of selection is only 1, then its amount(column j) will be displayed.
If the count of selection are 2 or more, then the dates will be compared. In the picture's case, it is (5/15 and 4/15). The dates will be compared to get the highest. If there are two or more highest date, the amount will be added, if there's only one, then it will be displayed. Here's my code;
Dim ws1 As Worksheet, wsm As Worksheet
Dim wb1 As Workbook
Dim Loc As Range
Dim crt As Integer, r As Long, c As Long, last As Long
ctr = 0
i = 3
Set wb1 = ThisWorkbook
Set ws1 = wb1.Sheets("SHIPNET102")
Set wsm = wb1.Sheets("MACRO TEMPLATE")
last = ws1.Cells(Rows.Count, "A").End(xlUp).Row
Do Until ws1.Cells(i, 7) = ""
Set Loc = ws1.Cells(i, 7).Find(What:="*WAGE*SUM*")
If Loc Is Nothing Then
i = i + 1
Else
ctr = ctr + 1
i = i + 1
End If
Loop
If ctr > 1 Then
'?
Else
r = Loc.Row
c = Loc.Column + 3
wsm.Cells(5, 3) = ws1.Cells(r, c)
End If
So far that's my outcome. It only counts number of cell that contains the word Wage and Sum and display the amount if the count is only 1. Any help would be appreciated.