Auto fill a cell by clicking a different cell

rfinnegan

Board Regular
Joined
Mar 15, 2005
Messages
173
Office Version
  1. 365
Platform
  1. Windows
Hi All:

I'm trying to fill cell O7 with the data from a cell related to the cell I click on. The following code was kindly supplied by this board a couple of years ago and worked perfectly for the dashboard I was working on. Unfortunately I can't get it to work in this case.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target(1).Address <> "$d$22" Then Range("d22").Value = "" & Target(1).Formula
End Sub

Let me explain why & what I'm trying to do -

I have a table of about 450 cells that list the replenishment needs for a store. Each cell contains the needs of a specific item. For example, cell H13 lists the needs of Children's Tops - Size Small, Cell I13 lists the needs of Children's Tops - Size Medium, etc. The needs are displayed as the number of boxes needed; 1,2,3 etc.

What I'd like to do is click on a cell and have the bar code associated with that item appear in cell O7. This would allow the person filling the orders to scan the bar code and accurately capture the SKU rather than hand enter it, which has lead to incorrect SKU's.

I planned to do this by having another table (hidden) next to the table with the replenishment needs. That table would contain the SKU from which the bar code is based. So cell H13 (Children's Tops - Size Small,) will have the associated SKU in cell W13.

In the end, I want to click on H13 and have the info from W13 appear in O7. Or click I13 and have the info from X13 appear in O7, etc... (O7 will simply be set with a barcode font)

I think all I need to do is modify the above code to include an offset of 13 cells, but I can't get it to work.

All help is appreciated.

Thanks in advance.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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