I recorded a macro that will filter my data for 34945, select all the cells with that number and then change them all to 7529 and then paste all of those into another worksheet. It looks like this:
Sub Change_34945()
'
' Change_34945 Macro
'
'
Sheets("Transactions").Select
ActiveSheet.Range("$A$1:$AA$31579").AutoFilter Field:=5, Criteria1:="34945"
Range("E2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.FormulaR1C1 = "7529"
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Macros").Select
Range("A1").Select
ActiveSheet.Paste
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Application.CutCopyMode = False
Selection.AutoFilter
Range("A1").Select
End Sub
However, because of the way I highlighted the cells using ctrl+shift+down if there is not a row that contains 34945 excel will enter 7529 in all cells starting at the last row containing text and going to the last row in the worksheet. So, how do I get it to only enter in 7529 if there is a cell there that contains 34945? I am pretty sure I need an IF statement but unsure how to write one in VBA.