change name of cells if other cell changes name?

JMITCH26

Board Regular
Joined
May 18, 2005
Messages
91
How can I change name of cells if 1 cell changes name.

If A1 has the name "Store Rack 1"
then Cells display names Pens, platic Bags, Paper in cells D5, F5, H5

If A1 has the name "Store Rack 2"
then Cells display names eraser, Box, Pencil in cells D5, F5, H5

Example:1
If Cell A1 = Store Rack 1

Then
Cell D5 = Pens
Cell F5 = Plastic Bags
Cell H5 =Paper

Example:2
If Cell A1 = Store Rack 2

Then
Cell D5 = easer
Cell F5 = Box
Cell H5 =pencil

any help on this will be great.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Try this:
This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window

When you enter the proper value in Range("A1") the script will run.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Modified  1/21/2019  1:09:02 AM  EST
If Target.Address = Range("A1").Address Then
    If Target.Value = "Store Rack 1" Then
        [D5] = "Pens"
        [F5] = "Plastic Bags"
        [H5] = "Paper"
    End If
    If Target.Value = "Store Rack 2" Then
        [D5] = "eraser"
        [F5] = "Box"
        [H5] = "Pencil"
    End If
End If
End Sub
 
Upvote 0
Or if you plan to do a lot more this may be easier.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Modified  1/21/2019  1:26:02 AM  EST
If Target.Address = Range("A1").Address Then
Select Case Target.Value
    Case "Store Rack 1"
        [D5] = "Pens"
        [F5] = "Plastic Bags"
        [H5] = "Paper"
    Case "Store Rack 2"
        [D5] = "eraser"
        [F5] = "Box"
        [H5] = "Pencil"
End Select
End If
End Sub
 
Upvote 0
That is working.. Not sure they will let us run macros at work but it is working at home thank you.
 
Upvote 0

Forum statistics

Threads
1,224,752
Messages
6,180,742
Members
452,996
Latest member
nelsonsix66

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