Hello,
I'm working on a file and trying to write a code to replace the text in the first column once I apply a filter to the 2nd column. i.e., I filter column 2 for "Dogs" and need to replace column one (which has text of "cat") with "dogs". I have one row of headers which I would like to exclude. So far this is the code I have which isn't working
Selection.AutoFilter
ActiveSheet.Range("$A$1:$CO$4909").AutoFilter Field:=2, Criteria1:="Dog"
Range("A1").Select
ActiveCell.Offset(1, 0).Select
Cells(Columns("A").Rows.Count, "A").End(xlUp).Select
If ActiveCell.Value = "CAT" Then
ActiveCell.Value = "DOG"
ActiveCell.Offset(0, 1).Select
ActiveCell.Offset(0, -1).Select
End if
End Sub
Or even just a way to replace whatever text is in column A with "Dog", it doesn't have to say cat for it to be replace. In other words, I can select all of the active rows in the first column and have it say dog in each row
I'm working on a file and trying to write a code to replace the text in the first column once I apply a filter to the 2nd column. i.e., I filter column 2 for "Dogs" and need to replace column one (which has text of "cat") with "dogs". I have one row of headers which I would like to exclude. So far this is the code I have which isn't working
Selection.AutoFilter
ActiveSheet.Range("$A$1:$CO$4909").AutoFilter Field:=2, Criteria1:="Dog"
Range("A1").Select
ActiveCell.Offset(1, 0).Select
Cells(Columns("A").Rows.Count, "A").End(xlUp).Select
If ActiveCell.Value = "CAT" Then
ActiveCell.Value = "DOG"
ActiveCell.Offset(0, 1).Select
ActiveCell.Offset(0, -1).Select
End if
End Sub
Or even just a way to replace whatever text is in column A with "Dog", it doesn't have to say cat for it to be replace. In other words, I can select all of the active rows in the first column and have it say dog in each row
Last edited: