Is this possible

bam12

Well-known Member
Joined
Dec 6, 2004
Messages
983
If I put a value into a cell, is it possible to move it to other
cells
example. In cell A1 put 0198
cell B1 contains the following 6-0197-0001. I want the cell contents
of A1 to replace the 0197, so that the contents of cell B1
is now 6-0198-0001.
This will happen to many rows
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
This assumes that column A is formatted as Text so that when you enter 0198 it displays as 0198 not 198.

Right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then
    If Target.Offset(, 1).Value <> "" Then
        Application.EnableEvents = False
            With Target.Offset(, 1)
                .Value = Left(.Value, 2) & Target.Value & Right(.Value, 5)
            End With
        Application.EnableEvents = True
    End If
End If
End Sub

Then press ALT + Q to close the code window.
 

Matty

Well-known Member
Joined
Feb 17, 2007
Messages
3,710
Hi,

Can the following digits change:

6-####-0001

Or will they remain static?

Matty
 

Watch MrExcel Video

Forum statistics

Threads
1,130,169
Messages
5,640,550
Members
417,151
Latest member
ChickenTenderer

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top