Numbers in different areas on page? Part 2

z12ent

New Member
Joined
Dec 5, 2018
Messages
5
Hello I have a question? In Excel I have list of the same numbers but in different areas on my sheet. Example 1 2 3 4 5. Now if I wanted all the 1's to change if I entered 6 in place of 1 what formula would I use rather than going through the entire page changing all the 1's to 6's?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Press ctrl + H to replace everything on the sheet.

The formula would be =SUBSTITUTE(A1,1,6)
 
Last edited:
Upvote 0
Another approach using VBA event, no formula.

Paste this code into your SHEET MODULE -- And Change Line 2 of Code to cover the Range to be Included/Covered.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Set Rng = Range("B6:F15")   'CHANGE THIS RANGE AREA TO YOUR RANGE AREA BEFORE ALLOWING TO RUN
Application.EnableEvents = False
Ent = Target.Value
Application.Undo
Bef = Target.Value
With Rng
    For Each C In .Cells
        If C = Bef Then
            C.Value = Ent
        End If
    Next C
End With
Application.EnableEvents = True
End Sub
 
Upvote 0
Hi Jim, thanks for the reply but is that code for excel or VB?

Just want to change all the numbers in excel when I change the main number? The first row will always remain the same, it's the second row that will always change and I'd like for the change to happen to all the same / related fields under 1 or 2 or 3 or 4 or 5. Example:

1 2 3 4 5
21 22 16 44 55
 
Upvote 0
Are you familiar with the VB Editor within Excel? The code I provided gets posted in the code sheet of the same sheet you are working with, NOT A STANDARD MODULE.

Im not understanding the 21, 22, 16, 44, 55. What were there values originally, if these are the values after the changes...
 
Last edited:
Upvote 0
Jim,

Sorry I'm new to excel so my verbiage my not be up to par. I didn't know where to place the code you provided so when doing a google search VB poped up. I'd upload you a photo to better explain what I'm trying to achieve but since it's not attached to a url it won't allow me to do so. So to better explain what I'm trying to have the program do is when i replace a number that is repeated in multiple areas i want all those related numbers to change as well.
 
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,849
Members
449,194
Latest member
HellScout

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