I'm attempting to use a select case on a column of numbers.
e.g. (111, 56, 49, 92) if the value is equal to 111 then display "Test".
Sub Test()
Dim cd As Range
Dim wsSort As Worksheet
Set wsSort = Workbooks("Test.xlsm").Worksheets(2)
Set cd = wsSort.Columns("I")
Select Case cd
Case Is = 111
wsSort.Range("I10").Offset(0, -2) = "test"
End Select
MsgBox ("Done")
End Sub
This is for a single cell. So I had: Set cd = wsSort.Range("I10")
, but now I need to replicate this for the entire column. Case Is = 111
I believe that I need to make the amends here but I get a type mismatch error on this line.
UPDATED CODE
Sub Test()
Dim cd As Range
Dim wsSort As Worksheet
Set wsSort = Workbooks("Learner data Elliot.xlsm").Worksheets(2)
Set cd = wsSort.Columns("I")
With wsSort
Select Case LastRow = .Range("I" & .Rows.Count).End(xlUp).Row
Case Is = 111
wsSort.Columns("I").Offset(0, -2) = "test"
End Select
End With
MsgBox ("Done")
End Sub