Macro Help

ai1094

Board Regular
Joined
Aug 23, 2018
Messages
92
Hello everyone. I am a new user and a beginner in Excel's VBA.

I was wondering how to create a macro that searches for a specific text, and any value associated to that text will shift over to a certain column. I would assume I would need to use an If Then statement, but like I said, I am very fresh to VBA and only know how to record macros as opposed to writing my own.

I would appreciate some help/feedback. Thanks! :)
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
.
will shift over to a certain column

Do you mean 'copy and paste' to another column ?

If the term is located, are you wanting to copy everything in that cell / row / column ?
 
Upvote 0
Ok I want the code to look at a column. If that column contains the specific text I'm looking for, I want it to look at a value in a different column and cut that value, and paste it into a different column.
 
Upvote 0
.
Good. Its getting clearer now.

What column are you wanting to search .... then which column are you wanting to copy the data from.

Example:

Search ColA for the term SALARY. Then three columns over in ColD, on the same row as the term was located, copy that number and paste to .... where ?
 
Upvote 0
Ok for example.

Column C has:
Actual Demand
Projected Demand

-I want to tell the code to look for the text “Actual Demand” and if it finds it, to look at a different column that contains a number value in that same row and to move that number value to a different column.
 
Upvote 0
.
to look at a different column that contains a number value in that same row - which column ?


and to move that number value to a different column. - which column and what cell ?

What happens if the search finds more than one "ACTUAL DEMAND" ? Example: ACTUAL DEMAND located in C2 & C14 & C21 & C22 etc etc
Where do all those number values in the adjacent column get pasted to ? Or will there only be one instance of ACTUAL DEMAND in Col C ?
 
Last edited:
Upvote 0
There will be more than one Actual Demand. I want the code to loop through each text that contains that text and when it finds a value in the same row but different column, to cut and paste it to it’s appropriate column but same row.
 
Upvote 0
.
Well ... when you decide to provide all the information required to construct the macro for you ... please post it.

Best wishes.
 
Upvote 0
COL A COL B COL C COL D COL E COL F
Actual/Projected Demand | Actual/Projected Supply| Actual Supply | Actual Demand | Projected Supply | Projected Demand
Projected Demand Projected Supply 333 232
Projected Demand Projected Supply 486 387
Projected Demand Projected Supply 223 189

Ok I want the macro to look at COL A and COL B and look for the texts "Projected Demand" and "Projected Supply." Then I want it to look at the same row where the value is stored and place it in it's appropriate column. For example, Row 2: Projected Demand And Projected Supply is 333, ad 232. I want to move the value 333 to COL E and 232 to COL F. Do you understand now?
 
Upvote 0
Ok the format messed up when I posted my reply so just try to space everything out in it's appropriate place.
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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