VBA - Change value in column J based on value in column H

I need to put "US" in each row for column H where J = "PR" &
put "US" in each row for column M where K = "PR"

I do not know how long the list will be, but need to use Column A to define the "last row" as there may be blanks in other columns.

Thanks!
Euro5Asked:
Who is Participating?
I wear a lot of hats...

"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.

Roy CoxGroup Finance ManagerCommented:
Can you attach an example workbook
0
Euro5Author Commented:
0
ProfessorJimJamCommented:
Vba or formula?
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

ProfessorJimJamCommented:
please find attached formula solution
prsample.xlsx
0
MacroShadowCommented:
Here's a VBA solution:
Sub EE_28681875()

    Dim rCell As Range
    Dim rRng As Range

    Set rRng = Sheet1.Range("A1:A" & Sheet1.Cells(Sheet1.Rows.Count, "A").End(xlUp).Row)

    For Each rCell In rRng.Cells
        If Range("J" & rCell.Row).Value = "PR" Then Range("H" & rCell.Row).Value = "US"
        If Range("K" & rCell.Row).Value = "PR" Then Range("M" & rCell.Row).Value = "US"
    Next rCell

End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ProfessorJimJamCommented:
and vba

Sub test()
Dim C As Range
Dim IR As Long
For IR = 2 To Cells(Rows.Count, "A").End(xlUp).Row
If Cells(IR, 10).Value = "PR" Then
Cells(IR, 8).Value = "US"
If Cells(IR, 11).Value = "PR" Then
Cells(IR, 13).Value = "US"
End If
End If
Next
End Sub

Open in new window

0
Euro5Author Commented:
Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

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.