Replacing Cell Contents

Sineadd

Board Regular
Joined
Apr 24, 2019
Messages
58
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi

I have an excel sheet where on Tab A I will have a drop down menu on column C (Products). This drop down menu will list all the fields from TAB B( Company name)
When I select TEST 1 on TAB A in column C I want the Product description from TAB B to populate in the column C. Is this possible??

TAB A
CompanySKUProducts
Company 1Test2


TAB B
Company NameProduct DescriptionProducy SKU
Test 1Corner SofaABCD-123-ABC
Test 22 Seater Sofa Velvet BlueAPR-ABB-BLU
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
do you want to replace the contents of C - so instead of
TEST2 it is replaced by
which seems to be implied in

2 Seater Sofa Velvet Blue
 
Upvote 0
do you want to replace the contents of C - so instead of
TEST2 it is replaced by
which seems to be implied in

2 Seater Sofa Velvet Blue
Yes I want to replace the contents of cell C
 
Upvote 0
so VBA needed not my area - sorry
 
Upvote 0
I have inputted the below VBA code but I then have to select the ranges manually via pop up boxes.

Sub VBA_Replace()

Dim Rng As Range
Dim InputRng As Range, ReplaceRng As Range

xTitleId = "VBA_Replace"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Original Range ", xTitleId, InputRng.Address, Type:=8)
Set ReplaceRng = Application.InputBox("Replace Range :", xTitleId, Type:=8)
Application.ScreenUpdating = False

For Each Rng In ReplaceRng.Columns(1).Cells
InputRng.Replace what:=Rng.Value, replacement:=Rng.Offset(0, 1).Value, Lookat:=xlWhole

Next

End Sub

So Basically the Macro should look up the Original Range -This is in TAB A, Column C and return the value from Column B on TAB B

The Replace Range for the above code is Column A & Column B on TAB B


Hope that all makes sense
 
Upvote 0

Forum statistics

Threads
1,215,443
Messages
6,124,890
Members
449,194
Latest member
JayEggleton

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