ConfusedinCanada
New Member
- Joined
- Jul 11, 2019
- Messages
- 1
Hi there,
So I've been given a task to find and replace items in a spreadsheet with a range. Now I've had 0 experience in VBA before this, so I'm a bit confused. And could use some help.
I will put it as simply as I can, because my brain gets confused when I go into the details of the task.
We'll say we have a spreadsheet with the workbook "Fruit". This workbook has two columns.
Column A is "Type", and Column B is "Location Picked".
We also have two ranges, named range1 and range2
range1 has ("orange", "apple", "pear"), and range2 ("Spain", "England", "France")
So what I want to do is search the column "Type" for everything in range1
Then, if say, I find "Orange" in Cell A4, I want to replace whatever is in Cell B4 with the first item in range2, which in this instance is "Spain"
And then loop over until everything has been replaced.
I hope I've made myself clear enough. If not, please let me know.
I could add some code, but what I have at the moment are parts of a whole. And I'm here because I can't figure out how to put them together. So any help would be appreciated.
EDIT
I need to do all of this in VBA.
So I've been given a task to find and replace items in a spreadsheet with a range. Now I've had 0 experience in VBA before this, so I'm a bit confused. And could use some help.
I will put it as simply as I can, because my brain gets confused when I go into the details of the task.
We'll say we have a spreadsheet with the workbook "Fruit". This workbook has two columns.
Column A is "Type", and Column B is "Location Picked".
We also have two ranges, named range1 and range2
range1 has ("orange", "apple", "pear"), and range2 ("Spain", "England", "France")
So what I want to do is search the column "Type" for everything in range1
Then, if say, I find "Orange" in Cell A4, I want to replace whatever is in Cell B4 with the first item in range2, which in this instance is "Spain"
And then loop over until everything has been replaced.
I hope I've made myself clear enough. If not, please let me know.
I could add some code, but what I have at the moment are parts of a whole. And I'm here because I can't figure out how to put them together. So any help would be appreciated.
EDIT
I need to do all of this in VBA.
Last edited by a moderator: