Need to edge out the competition for your dream job? Train for certifications today.
Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
Dim lastrow As Long, rng As Range
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
Application.ScreenUpdating = False
.AutoFilterMode = False
Set rng = .Range("B1:B" & lastrow)
rng.AutoFilter field:=1, Criteria1:="Savings and Deposits"
rng.Offset(0, -1).SpecialCells(12).Value = "Payments & Cash Management"
.Cells(lastrow + 1, 2) = ""
.AutoFilterMode = False
Application.ScreenUpdating = True
Set rng = Nothing
Open in new window
Dim WS As Worksheet
Dim lCount As Long
Dim cCell As Range
Dim sFind As String, sReplace As String
Dim FirstAddress As String
'---> Disable Events
.EnableEvents = False
.ScreenUpdating = False
.DisplayAlerts = False
'---> Set Variables
Set WS = ActiveSheet
sFind = "Savings and Deposits"
sReplace = "Payments & Cash Management"
'---> Start Process
Set cCell = .Find(what:=sFind, LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False)
If Not cCell Is Nothing Then
FirstAddress = cCell.Address
cCell.Offset(, -1).Value = sReplace
lCount = lCount + 1
Set cCell = .FindNext(cCell)
Loop While Not cCell Is Nothing And cCell.Address <> FirstAddress
'---> Enable Events
.EnableEvents = True
.ScreenUpdating = True
.DisplayAlerts = True
MsgBox "A total of " & lCount & " occurrences of " & sFind & " were found in Col B and corresponding cell in Col A were changed to " & replace
Dim x As String, y As String
With Intersect(ActiveSheet.UsedRange, ActiveSheet.Columns(2))
x = .Address
y = .Offset(, -1).Address
.Offset(, -1).Value = Evaluate("if(" & x & "=""Savings and Deposits"",""Payments & Cash Management"",if(len(" & y & ")," & y & ",""""))")
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment