rsernowski
asked on
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
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
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
ASKER
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.coun t,"B").END (Xlup).row
if cell f2 = USD
cells(lrow,1).value="Pleas e do FX"
?
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.coun
if cell f2 = USD
cells(lrow,1).value="Pleas
?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for quick Response! It worked
Have a good day
Have a good day
You can find the last row of B Column then using...
Open in new window
You can tweak your code accordingly...
Saurabh...