Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Simple Find/Replace Question
Excellent, thanks Mike.
-- Dan |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Simple Find and Replace Question | New Users to Excel | |||
Find & replace question.....I believe | Excel Discussion (Misc queries) | |||
Simple question to find min value | Excel Programming | |||
Simple Search and Replace Question | Excel Discussion (Misc queries) | |||
Find/Replace Question | Excel Discussion (Misc queries) |