I'm trying to write some code that will change all the cells in the selected column under some conditions.
My code can change the selected cell but crushes when I try to change all the selected column.
Dim ActSheet As Worksheet
Dim MyRange As Range
Set ActSheet = ActiveSheet
Set MyRange = Selection
If MyRange.Cells.Value = "Clothes" Then
MyRange.Cells.Value = 2
ElseIf MyRange.Cells.Value = "Extra" Then
MyRange.Value = 3
ElseIf MyRange.Cells.Value = "Shoes" Then
MyRange.Value = 1
End If
It works fine when I'm trying to change all the column color for example, but not on the value.