My idea is to fill the cells on column H depending on what the corresponding cell in the range A:A,D:D,F:F contains.
I'm getting the run-time error 13 (type mismatch) on the line Case "Done", though I'm not sure why, as both the selected range and the variable input are strings. I've always used if-loops, this is the first time I'm using select case, but despite having read the reference I still don't know what am I doing wrong.
The second question is how to define the last filled row of a range as the end of a new range. Right now with newRange.Value I'm attributing a value to the entire column, but I'm trying to make sure it only applies to the corresponding cell.
(For clarification, if for example cell A3 contains a value, that means D3 and F3 are empty, so each row in the range A:A,D:D,F:F only contains one value.)
Sub setStatus()
Dim dataRange As Range
Dim newRange As Range
Set dataRange = Range("A:A,D:D,F:F")
Set newRange = Range("H:H")
Select Case dataRange.Value
Case "Done"
newRange.Value = "Completed"
Case "WIP"
newRange.Value = "In Progress"
'In reality there are many different cases,
'hence the select case instead of an if loop
End Select
Next
End Sub
Application.MatchApplied on Array Instead ofSelect Case