![]() |
to replace a value in each cell of a column
Please let me know how I can write a macro in excel to replace a value in
each cell of the entire column example. in column B '1' - replaced with 'Invoice' 'C' - replaced with 'Credit note' I dont not mean in menu - Find - Replace . With thanks Pol |
to replace a value in each cell of a column
Sub Macro1()
Columns("A:A").Replace What:="I", Replacement:="Invoice", _ LookAt:=xlWhole, SearchOrder:=xlByRows Columns("A:A").Replace What:="c", Replacement:="Credit Note", _ LookAt:=xlWhole, SearchOrder:=xlByRows End Sub Why dont you try recording one........ -- If this post helps click Yes --------------- Jacob Skaria "pol" wrote: Please let me know how I can write a macro in excel to replace a value in each cell of the entire column example. in column B '1' - replaced with 'Invoice' 'C' - replaced with 'Credit note' I dont not mean in menu - Find - Replace . With thanks Pol |
to replace a value in each cell of a column
Sub replacer()
n = Cells(Rows.Count, "B").End(xlUp).Row For i = 1 To n With Cells(i, "B") If .Value = 1 Then .Value = "Invoice" If .Value = "C" Then .Value = "Credit note" End With Next End Sub -- Gary''s Student - gsnu200854 |
to replace a value in each cell of a column
Thanks it is working fine. Thansk a lot
"Jacob Skaria" wrote: Sub Macro1() Columns("A:A").Replace What:="I", Replacement:="Invoice", _ LookAt:=xlWhole, SearchOrder:=xlByRows Columns("A:A").Replace What:="c", Replacement:="Credit Note", _ LookAt:=xlWhole, SearchOrder:=xlByRows End Sub Why dont you try recording one........ -- If this post helps click Yes --------------- Jacob Skaria "pol" wrote: Please let me know how I can write a macro in excel to replace a value in each cell of the entire column example. in column B '1' - replaced with 'Invoice' 'C' - replaced with 'Credit note' I dont not mean in menu - Find - Replace . With thanks Pol |
All times are GMT +1. The time now is 01:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com