larinda4
Board Regular
- Joined
- Nov 15, 2021
- Messages
- 74
- Office Version
- 365
- Platform
- Windows
Good morning,
Is there any way to skip part of a macro? I'm trying to build a macro that will transfer information from an old update form to a new one but I'm facing a couple inconsistency's.
I used a Find & Replace to update a cell to make a VLOOKUP work on another tab, however, I'm noticing that not all workbooks require the Find & Replace.
So my question is, if the word I'm trying to update is already updated, how do I skip passed the Find & Replace? I tried doing an If, Then, Else but I keep getting a debug error: "Run-time error '5': Invalid procedure call or argument".
I've put the part of my code below but any input or suggestions would be greatly appreciated.
Cheers.
Is there any way to skip part of a macro? I'm trying to build a macro that will transfer information from an old update form to a new one but I'm facing a couple inconsistency's.
I used a Find & Replace to update a cell to make a VLOOKUP work on another tab, however, I'm noticing that not all workbooks require the Find & Replace.
So my question is, if the word I'm trying to update is already updated, how do I skip passed the Find & Replace? I tried doing an If, Then, Else but I keep getting a debug error: "Run-time error '5': Invalid procedure call or argument".
I've put the part of my code below but any input or suggestions would be greatly appreciated.
VBA Code:
If Cells("A7") = "U/T" Then
Columns("A:A").Select
ActiveCell.Replace What:="U/T", Replacement:="Technician", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:= _
False, ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Selection.Find(What:="U/T", After:=ActiveCell, LookIn:=xlFormulas2, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Replace What:="U/T", Replacement:="Technician", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:= _
False, ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Else
End If
'Select New GroupUpdateForm
Sheets(2).Select
Cheers.