Help with VBA Code

JAYORE

New Member
Joined
Jun 7, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I am not very good with Macros or VBA and have been trying to write a VBA to perform a copy of specific columns where a "Yes" is detailed in the entirety of Column L and if identified to then paste any data held in that row between Column A:M from that sheet to another sheet starting at Cell A54.

I am hoping that it may also be possible that once the data has been reviewed and the pasted data showing a "Yes" is changed to "Complete" that it would either replace the data it was taken from or change it in the initial sheet before it was copied from "Yes" to "Complete"

There are multiple sheets that this data with a "Yes" needs to be identified which are detailed as Sheet1, then Sheet4 to Sheet14.

The destination Sheet for the data with a "Yes" to be pasted to is Sheet3 and Cell A54 and any data taken from these 12 sheets needs to be copied in the next available blank line once 1 sheet of data is pasted etc...

Sheet2 is not in use for anything other than data used for other functions in cells such as lists etc...

The reason I am doing a VBA is to automatically have this run each time the workbook is open which will be a shared book.

I have attached below what I had put together but as I said earlier I am not very good at this and any help would be appreciated please.

Regards

Jase


Sub Import_Aux_Yes()

A = Worksheets("Sheet3").Cells(Rows.Count, 1).End(xlUp).Row

For i = 3 To A

If Worksheets("Sheet1").Cells(i, 12).Value = "Yes" Then

Worksheets("Sheet1").Cells(i, 1).Copy
Worksheets("Sheet3").Activate
b = Worksheets("Sheet3").Cells(Rows.Count, 4).End(xlUp).Row
Worksheets("Sheet3").Cells(A54).Select
Selection.PasteSpecial Paste:=xlPasteValues
Worksheets("Sheet1").Cells(i, 1).Copy
Worksheets("Sheet4").Activate
b = Worksheets("Sheet4").Cells(Rows.Count, 4).End(xlUp).Row
Worksheets("Sheet4").Cells(A54).Select
Selection.PasteSpecial Paste:=xlPasteValues
Worksheets("Sheet1").Cells(i, 1).Copy
Worksheets("Sheet5").Activate
b = Worksheets("Sheet5").Cells(Rows.Count, 4).End(xlUp).Row
Worksheets("Sheet5").Cells(A54).Select
Selection.PasteSpecial Paste:=xlPasteValues
Worksheets("Sheet1").Cells(i, 1).Copy
Worksheets("Sheet6").Activate
b = Worksheets("Sheet6").Cells(Rows.Count, 4).End(xlUp).Row
Worksheets("Sheet6").Cells(A54).Select
Selection.PasteSpecial Paste:=xlPasteValues
Worksheets("Sheet1").Cells(i, 1).Copy
Worksheets("Sheet7").Activate
b = Worksheets("Sheet7").Cells(Rows.Count, 4).End(xlUp).Row
Worksheets("Sheet7").Cells(A54).Select
Selection.PasteSpecial Paste:=xlPasteValues
Worksheets("Sheet1").Cells(i, 1).Copy
Worksheets("Sheet8").Activate
b = Worksheets("Sheet8").Cells(Rows.Count, 4).End(xlUp).Row
Worksheets("Sheet8").Cells(A54).Select
Selection.PasteSpecial Paste:=xlPasteValues
Worksheets("Sheet1").Cells(i, 1).Copy
Worksheets("Sheet9").Activate
b = Worksheets("Sheet9").Cells(Rows.Count, 4).End(xlUp).Row
Worksheets("Sheet9").Cells(A54).Select
Selection.PasteSpecial Paste:=xlPasteValues
Worksheets("Sheet1").Cells(i, 1).Copy
Worksheets("Sheet10").Activate
b = Worksheets("Sheet10").Cells(Rows.Count, 4).End(xlUp).Row
Worksheets("Sheet10").Cells(A54).Select
Selection.PasteSpecial Paste:=xlPasteValues
Worksheets("Sheet1").Cells(i, 1).Copy
Worksheets("Sheet11").Activate
b = Worksheets("Sheet11").Cells(Rows.Count, 4).End(xlUp).Row
Worksheets("Sheet11").Cells(A54).Select
Selection.PasteSpecial Paste:=xlPasteValues
Worksheets("Sheet1").Cells(i, 1).Copy
Worksheets("Sheet12").Activate
b = Worksheets("Sheet12").Cells(Rows.Count, 4).End(xlUp).Row
Worksheets("Sheet12").Cells(A54).Select
Selection.PasteSpecial Paste:=xlPasteValues
Worksheets("Sheet1").Cells(i, 1).Copy
Worksheets("Sheet13").Activate
b = Worksheets("Sheet13").Cells(Rows.Count, 4).End(xlUp).Row
Worksheets("Sheet13").Cells(A54).Select
Selection.PasteSpecial Paste:=xlPasteValues
Worksheets("Sheet1").Cells(i, 1).Copy
Worksheets("Sheet14").Activate
b = Worksheets("Sheet14").Cells(Rows.Count, 4).End(xlUp).Row
Worksheets("Sheet14").Cells(A54).Select
Selection.PasteSpecial Paste:=xlPasteValues

End If

Next


End Sub
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,144,341
Messages
5,723,808
Members
422,518
Latest member
quack_quack

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
Top