VBA to copy certain data in a row to a new worksheet based on criteria

ggtrixabell

New Member
Joined
Sep 18, 2017
Messages
7
Hi,
I am very new to VBA and have been struggling to find everything I need in one place to complete a task I'd like to do. Any help would be much appreciated.

I have a risk register which captures threats and issues that may occur within my projects. The outcome of those could be a task or an opportunity. I would like to be able to have the team click a button which then runs a macro to look at any risks or issues that have an outcome as 'TASK' and then copy the details to a separate worksheet in my workbook so that the task table can be progressed away from the main capture table. The same goes for any opportunities.
The data would need to be copied and then have the values only pasted to the relevant table in the other 2 worksheets because I have formulas working out the reference number for each new threat/issue in the main table.
My data table on Sheet1 looks like this:

[TABLE="width: 500"]
[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[TD]K[/TD]
[TD]L[/TD]
[TD]M[/TD]
[TD]N[/TD]
[TD]O[/TD]
[TD]P[/TD]
[TD]Q[/TD]
[TD]R[/TD]
[TD]S[/TD]
[TD]T[/TD]
[TD]U[/TD]
[TD]V[/TD]
[TD]W[/TD]
[TD]X[/TD]
[TD]Y[/TD]
[TD]Z[/TD]
[TD]AA[/TD]
[TD]AB[/TD]
[TD]AC[/TD]
[TD]AD[/TD]
[/TR]
[TR]
[TD]
REF[/TD]
[TD]Project Code[/TD]
[TD]Project Name[/TD]
[TD]Project Lead[/TD]
[TD]Status[/TD]
[TD]Date Raised[/TD]
[TD]TYPE[/TD]
[TD]Raised By[/TD]
[TD]Desc[/TD]
[TD]Impact[/TD]
[TD]Proximity1 (Dept)[/TD]
[TD]Proximity2 (Dept)[/TD]
[TD]Proximity (Timeline)[/TD]
[TD]Cost[/TD]
[TD]Revenue[/TD]
[TD]Quality[/TD]
[TD]Timeframe[/TD]
[TD]Absolute Prob[/TD]
[TD]Absolute Impact[/TD]
[TD]Risk Score[/TD]
[TD]Risk Level[/TD]
[TD]Outcome[/TD]
[TD]Assigned to[/TD]
[TD]Action[/TD]
[TD]Status[/TD]
[TD]Approved By[/TD]
[TD]Approval Date[/TD]
[TD]Completion Date[/TD]
[TD]Notes[/TD]
[TD]Doc Ref Number[/TD]
[/TR]
[TR]
[TD]Calculated using the project code B & Name C with unique number -001 etc[/TD]
[TD]*[/TD]
[TD]*[/TD]
[TD]*[/TD]
[TD]*[/TD]
[TD]*[/TD]
[TD]*[/TD]
[TD]*[/TD]
[TD]*[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]TASK[/TD]
[TD]*[/TD]
[TD]*[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]*[/TD]
[TD]*[/TD]
[TD]*[/TD]
[TD]*[/TD]
[TD]*[/TD]
[TD]*[/TD]
[TD]*[/TD]
[TD]*[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Opportunity[/TD]
[TD]*[/TD]
[TD]*[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[/TABLE]


When the activex button is pressed, I'd like the macro to look for any new "TASK" or "Opportunity" (In column V) that has been added since the last time it was run and to then copy the data in that row but only cells A-I and W-X (I've starred the columns above) if possible, to the corresponding worksheet - Task or Opportunity..

I've managed to get as far as identifying the task or opportunity and copying the row onto the correct worksheet but that's it..

Sorry if this is a complicated explanation, my first time posting too...Any help much appreciated.

Thank you :)
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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