I have an interesting task to accomplish via VBA. I, basically, need to select entire row based on criteria value="REZ" in column "C". Code that I got for that is:
Dim c As Range
Dim rngG As Range
For Each c In Intersect(ActiveSheet.UsedRange, Columns("C"))
If c = "REZ" Then
If rngG Is Nothing Then Set rngG = c.EntireRow
Set rngG = Union(rngG, c.EntireRow)
End If
Next c
rngG.Select
Each selected row has some value in column "J". So now I need to additionally select all entire rows that contains those values gotten from first step.
Images to better explain: Firstly we need to get rows with "REZ" in column "C"
https://i.stack.imgur.com/uwHzT.png
Now we know that rows value in column "J" which in this case is "27.2.12" So now additionally to what we have selected we need to select all the rows that contain "27.2.12" which is ALWAYS some number of rows directly after the row found and selected in step 1 and never match exactly as each value in column "J" is unique. In this case it would be:
https://i.stack.imgur.com/ZMQpI.png
I imagine is as two IF functions where the second one takes the info from the result of the first.
Would someone please help me add to and modify the code that I already have?
Workbook example: https://easyupload.io/yewg9o
I highlighted "REZ" rows with yellow that are selected in step 1 and cells that I expect to be selected based on step 1 are highlighted with green.
Aucun commentaire:
Enregistrer un commentaire