VBA code needed

vikas9385

Board Regular
Joined
Aug 29, 2009
Messages
96
Workbook 1 (Main data is available in it)....format of the data is given below:


[TABLE="width: 405"]
<colgroup><col span="9"></colgroup><tbody>[TR]
[TD][/TD]
[TD="colspan: 3"]workbook 1: Data[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD] [/TD]
[TD="align: right"]1501[/TD]
[TD] [/TD]
[TD="align: right"]1502[/TD]
[TD] [/TD]
[TD="align: right"] 1503[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD] [/TD]
[TD] S[/TD]
[TD] T[/TD]
[TD] S[/TD]
[TD] T[/TD]
[TD] S[/TD]
[TD] T[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]1[/TD]
[TD]+[/TD]
[TD="align: right"]30[/TD]
[TD="align: right"]42[/TD]
[TD="align: right"]24[/TD]
[TD="align: right"]57[/TD]
[TD="align: right"]85[/TD]
[TD="align: right"]24[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]2[/TD]
[TD]-[/TD]
[TD="align: right"]82[/TD]
[TD="align: right"]25[/TD]
[TD="align: right"]17[/TD]
[TD="align: right"]75[/TD]
[TD="align: right"]52[/TD]
[TD="align: right"]17[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]3[/TD]
[TD]+[/TD]
[TD="align: right"]45[/TD]
[TD="align: right"]44[/TD]
[TD="align: right"]82[/TD]
[TD="align: right"]89[/TD]
[TD="align: right"]82[/TD]
[TD="align: right"]82[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]1[/TD]
[TD]-[/TD]
[TD="align: right"]79[/TD]
[TD="align: right"]95[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]83[/TD]
[TD="align: right"]67[/TD]
[TD="align: right"]50[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]2[/TD]
[TD]+[/TD]
[TD="align: right"]90[/TD]
[TD="align: right"]80[/TD]
[TD="align: right"]55[/TD]
[TD="align: right"]74[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]55[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]3[/TD]
[TD]-[/TD]
[TD="align: right"]48[/TD]
[TD="align: right"]34[/TD]
[TD="align: right"]18[/TD]
[TD="align: right"]40[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]18[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]1[/TD]
[TD]+[/TD]
[TD="align: right"]83[/TD]
[TD="align: right"]91[/TD]
[TD="align: right"]57[/TD]
[TD="align: right"]67[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]57[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]2[/TD]
[TD]-[/TD]
[TD="align: right"]27[/TD]
[TD="align: right"]40[/TD]
[TD="align: right"]49[/TD]
[TD="align: right"]90[/TD]
[TD="align: right"]88[/TD]
[TD="align: right"]49[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD="align: right"]3[/TD]
[TD]+[/TD]
[TD="align: right"]93[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]75[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]25[/TD]
[TD="align: right"]75[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD="align: right"]2[/TD]
[TD]-[/TD]
[TD="align: right"]92[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]19[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]61[/TD]
[TD="align: right"]19[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD="align: right"]3[/TD]
[TD]-[/TD]
[TD="align: right"]38[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]70[/TD]
[TD="align: right"]14[/TD]
[TD="align: right"]59[/TD]
[TD="align: right"]70[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD="align: right"]2[/TD]
[TD]-[/TD]
[TD="align: right"]26[/TD]
[TD="align: right"]43[/TD]
[TD="align: right"]53[/TD]
[TD="align: right"]46[/TD]
[TD="align: right"]72[/TD]
[TD="align: right"]53[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD="align: right"]3[/TD]
[TD]-[/TD]
[TD="align: right"]79[/TD]
[TD="align: right"]55[/TD]
[TD="align: right"]83[/TD]
[TD="align: right"]14[/TD]
[TD="align: right"]68[/TD]
[TD="align: right"]83[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD="align: right"]1[/TD]
[TD]-[/TD]
[TD="align: right"]14[/TD]
[TD="align: right"]17[/TD]
[TD="align: right"]51[/TD]
[TD="align: right"]58[/TD]
[TD="align: right"]93[/TD]
[TD="align: right"]51[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD="align: right"]1[/TD]
[TD]+[/TD]
[TD="align: right"]74[/TD]
[TD="align: right"]37[/TD]
[TD="align: right"]29[/TD]
[TD="align: right"]51[/TD]
[TD="align: right"]45[/TD]
[TD="align: right"]29[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD="align: right"]2[/TD]
[TD]+[/TD]
[TD="align: right"]29[/TD]
[TD="align: right"]41[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]56[/TD]
[TD="align: right"]38[/TD]
[TD="align: right"]10[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD="align: right"]3[/TD]
[TD]+[/TD]
[TD="align: right"]37[/TD]
[TD="align: right"]24[/TD]
[TD="align: right"]52[/TD]
[TD="align: right"]77[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]52[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD="align: right"]1[/TD]
[TD]-[/TD]
[TD="align: right"]77[/TD]
[TD="align: right"]16[/TD]
[TD="align: right"]43[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]94[/TD]
[TD="align: right"]43[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD="align: right"]2[/TD]
[TD]-[/TD]
[TD="align: right"]36[/TD]
[TD="align: right"]48[/TD]
[TD="align: right"]34[/TD]
[TD="align: right"]82[/TD]
[TD="align: right"]70[/TD]
[TD="align: right"]34[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD="align: right"]3[/TD]
[TD]-[/TD]
[TD="align: right"]38[/TD]
[TD="align: right"]79[/TD]
[TD="align: right"]88[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]54[/TD]
[TD="align: right"]88[/TD]
[/TR]
</tbody>[/TABLE]


Want to copy data in various workbooks with the name of 1501 / 1502/1503 like that which is mentioned above each T & S group.

Step 1: open workbook on the basis of 1501 / 1502 / 1503 criteria

Step 2: paste the values as per below mentioned criterias


[TABLE="width: 320"]
<colgroup><col width="64" span="5" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64, align: right"]1501[/TD]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"] [/TD]
[/TR]
[TR]
[TD="class: xl65"] [/TD]
[TD="class: xl66"]S-total[/TD]
[TD="class: xl66"]T(1-total)[/TD]
[TD="class: xl66"]T(2-total)[/TD]
[TD="class: xl66"]T(3-total)[/TD]
[/TR]
[TR]
[TD="class: xl66"]A[/TD]
[TD="class: xl66"] [/TD]
[TD="class: xl66"] [/TD]
[TD="class: xl66"] [/TD]
[TD="class: xl66"] [/TD]
[/TR]
[TR]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[/TR]
[TR]
[TD="class: xl66"] [/TD]
[TD="class: xl66"]T(1-total)[/TD]
[TD="class: xl66"]T(2-total)[/TD]
[TD="class: xl66"]T(3-total)[/TD]
[TD="class: xl65"] [/TD]
[/TR]
[TR]
[TD="class: xl66"]B[/TD]
[TD="class: xl66"] [/TD]
[TD="class: xl66"] [/TD]
[TD="class: xl66"] [/TD]
[TD="class: xl65"] [/TD]
[/TR]
[TR]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[/TR]
[TR]
[TD="class: xl66"] [/TD]
[TD="class: xl66"]T(1-total)[/TD]
[TD="class: xl66"]T(2-total)[/TD]
[TD="class: xl66"]T(3-total)[/TD]
[TD="class: xl65"] [/TD]
[/TR]
[TR]
[TD="class: xl66"]C[/TD]
[TD="class: xl66"] [/TD]
[TD="class: xl66"] [/TD]
[TD="class: xl66"] [/TD]
[TD="class: xl65"] [/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 320"]
<colgroup><col width="64" span="5" style="width:48pt"></colgroup><tbody></tbody>[/TABLE]



Each group values (A-S-1, B-T-1 LIKE THAT) should be pasted in respective column as per + or - sign

Any small help in this regard will be highly appreciated.

Thanks in advance

Vikas Negi
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,223,730
Messages
6,174,162
Members
452,548
Latest member
Enice Anaelle

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