Is this possible

bam12

Well-known Member
Joined
Dec 6, 2004
Messages
984
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

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
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.
 
Upvote 0
Hi,

Can the following digits change:

6-####-0001

Or will they remain static?

Matty
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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
Back
Top