Simple Find/Replace Question
I know this is easy but I can't seem to figure it out, I need a macro
that will replace "NYCITY" with "NYC" if it is pasted in column 3. Thanks, -- Dan |
Simple Find/Replace Question
Assuming "NYCITY" is the only text in that cell:
Sub NYC () Dim c As Range, rng As Range Dim Lrow as Long Lrow = Cells(Rows.Count, 3).End(xlUp).Row Set rng = Range("C1:C"& Lrow) For Each c in rng If c.Value = "NYCITY" Then c.Value = "NYC" Next End Sub Mike F "Dan R." wrote in message ups.com... I know this is easy but I can't seem to figure it out, I need a macro that will replace "NYCITY" with "NYC" if it is pasted in column 3. Thanks, -- Dan |
Simple Find/Replace Question
Excellent, thanks Mike.
-- Dan |
Simple Find/Replace Question
Dan,
Try this. If "NYCITY" is pasted in any row of column C, it will be replaced by "NYC". Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 3 And Target.Text = "NYCITY" Then Target.Value = "NYC" End If End Sub "Dan R." wrote: I know this is easy but I can't seem to figure it out, I need a macro that will replace "NYCITY" with "NYC" if it is pasted in column 3. Thanks, -- Dan |
Simple Find/Replace Question
How about recording a macro when you did
select the column edit|Replace what: NYCITY with: NYC replace all Be sure to check all the options you want so your macro can record them. "Dan R." wrote: I know this is easy but I can't seem to figure it out, I need a macro that will replace "NYCITY" with "NYC" if it is pasted in column 3. Thanks, -- Dan -- Dave Peterson |
All times are GMT +1. The time now is 02:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com