Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
pol pol is offline
external usenet poster
 
Posts: 129
Default 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



  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default 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
  #4   Report Post  
Posted to microsoft.public.excel.misc
pol pol is offline
external usenet poster
 
Posts: 129
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
to replace a value in each cell of the column pol Excel Discussion (Misc queries) 6 May 21st 09 03:16 PM
How to search in one column, and replace in the other column if fo Adnan Excel Discussion (Misc queries) 2 November 14th 08 01:03 PM
Can I replace a ' at the beginning of a text cell using Replace Hilde Excel Discussion (Misc queries) 4 September 10th 07 06:22 PM
Replace all non blanks in a column with column header hnyb1 Excel Discussion (Misc queries) 3 April 18th 06 05:39 PM
Find and Replace in a column Mort Snerd New Users to Excel 2 March 7th 06 03:44 PM


All times are GMT +1. The time now is 10:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"