add txt to last cell

Hello ,
I am looking for some Excel VBA code to add in a conditional txt message in  an excel macro. the row count will always change so the words cannot be in the  same row , but it can always be in Col B  

it would read something  like

If cell ( 2,1) = "USD"
add to the last row  in Column B
"Please Do FX"

thanks
rsernowskiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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

Saurabh Singh TeotiaCommented:
rsernowski,

You can find the last row of B Column then using...

dim lrow as long
lrow=cells(Cells.rows.count,"B").END(Xlup).row
cells(lrow,1).value="USD"

Open in new window


You can tweak your code accordingly...

Saurabh...
ProfessorJimJamMicrosoft Excel ExpertCommented:
Sub test()

lastR = Cells(Rows.Count, 2).End(xlUp).Row

For i = 2 To lastR

If Cells(i, 1).Value = "USD" Then
 Cells(i, 2).Value = "Please Do FX"
 End If
Next i
End Sub

Open in new window

rsernowskiAuthor Commented:
Thanks Saurabh

thanks
so I can find the last row, but I need a if statement ? the cell  F2 can either be USD or CAD. so it if it USD , then I need to add statement to the last row saying . "Please Do FX"
it looks like you are typing in USD

dim lrow as long
lrow=cells(Cells.rows.count,"B").END(Xlup).row
if cell f2 = USD
cells(lrow,1).value="Please do FX"

?
Saurabh Singh TeotiaCommented:
You will do this way...

dim lrow as long
lrow=cells(Cells.rows.count,"B").END(Xlup).row+1
if UCASE(trim(cells(2,1).value)) = "USD" THEN cells(lrow,1).value="Please do FX"

Open in new window


I'm assuming when you say last row you meant last filled row +1 which is blank so thefor did changes in the code...

Saurabh...

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
rsernowskiAuthor Commented:
Thanks for quick Response! It worked
Have a good day
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.