VBA to find string and paste to another Sheet

septimus

Board Regular
Joined
Nov 20, 2014
Messages
69
Dear all;
I have data table with following conditions:
+ Row from 1 to 14000.
+Column from A to DTY
I need VBA to make this function find and copy/paste as below:
+ I’ll type the name of string need to find in cell A1, B1,..(can expand later) to cell M1 of Sheet2
+ Be based on my strings, VBA will find in Sheet1.
+ Copy the value found to Sheet2

Maybe it’ll clear with this example:
Sheet1 (source)

A
B
C
D
……..
DTV
DTW
DTX
DTY
1
ID
Date
IN
Classify
……..
ScaleA
ScaleB
ScaleC
Results
2
M001
011515
2000
A
……..
0.5
0.3
0.2
G
3
M002
011515
2000
B
……..
0.5
0.3
0.2
G
4
M003
011515
2000
A
……..
0.5
0.3
0.2
F
5
ID
Date
IN
Classify
ScaleA
ScaleB
ScaleC
Results

6
M005
011515
2000
A
0.4
0.3
0.3
F

7
M006
011515
2000
D
0.4
0.3
0.3
B

….
….
….
….
….
….




13998
ID
Date
IN
Classify
….
ScaleA
ScaleB
ScaleC
Results
13999
M002
011515
2000
D
……..
0.2
0.1
0.5
F
14000
M006
011515
2000
A
……..
0.2
0.1
0.4
B
Sheet2 (result)

A
B
C
D
M




1
ScaleA
ScaleC
Classify
….
….




2
0.5
0.2
A
….
….




3
0.5
0.2
B
….
….




4
0.5
0.2
A
….
….




5
ScaleA
ScaleC
Classify
….
….




6
0.4
0.3
A
….
….




7
0.4
0.3
D
….
….




….
….


….
….




13998
ScaleA
ScaleC
Classify
….
….




13999
0.2
0.5
D
….
….




14000
0.2
0.4
A
….
….





<tbody>
</tbody>

I appreciate all your support
Thank you!!!
Septimus
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Sorry to trouble you because my English so bad.
I'll prepare clearly content later.
Thank you
 
Upvote 0
Dear Sir;
I would like to type the string on Cell A1, B1, C1 of Sheet2 and then VBA will find it on Sheet1 and copy/ paste that column in Sheet2.
In my example, I'll paste string "ScaleA", "ScaleB", "Classify" on Cell A1, B1, C1 of Sheet2.
And VBA will find entire in Sheet1 then copy the value found to Sheet2
Please note that it's not always in same column. (If the answer in cell A5 is "ScaleB" and next row are 0.3 --> It's wrong.
I'd want as below configure

 ABC
1ScaleAScaleCClassify
20.50.2A
30.50.2B
40.50.2A
5ScaleAScaleCClassify
60.40.3A
70.40.3D
 
13998ScaleAScaleCClassify
139990.20.5D
140000.20.4A

<tbody>
</tbody>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,315
Members
449,081
Latest member
tanurai

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