• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Macro to change cell value

Cammandk

Member
In Column L of worksheet "CostManager" if I have the Value "F001" (from Floats!$A3) I want the value on Column O to be changed to "P"
 
Wouldn't it just be easier to put a formula in col P?

=IF(L2="CostManager","P","")


If you need a macro, which row are we doing this for? Every row?
 
Just for some context the F001 is an Petty Cash No. When it's entered by user in COL L - Col O becomes "U" via formula to reflect its entered but unpaid. There could be multiple rows using this F001 for different cost centres. Once Petty Cash F001 has been processed by the accts dept I need to have the "U" changed to a "P" - so the macro needs to look through every row in COL L and if it finds match put "P" into COL O
 
How's this?

[pre]
Code:
Sub ChangeValue()
Dim lastRow As Long
lastRow = Range("L65536").End(xlUp).Row

Application.ScreenUpdating = False
For i = 2 To lastRow
If Cells(i, "L").Value = "CostManager" Then
Cells(i, "O").Value = "P"
End If
Next i
Application.ScreenUpdating = True
End Sub
[/pre]
 
Back
Top