Valid componet + Help with duplicates

Boogerbut74

New Member
Joined
Oct 17, 2022
Messages
26
Office Version
  1. 365
Platform
  1. Windows
most of my code works the only problem im having is after the for statement when it comes to Set colnum = Sheets("Deviation tracker").Columns.Count.End(xlToLeft).Offset + 1. I want to use this for statement to check if their is a depluicit in colum A for historian sheet from row 3 on dev tracker sheet. if their is a duplicate in the historian sheet delet that row if not use the code in the for statment to insert it in the spots needed
'
' Macro3_copystuffover Macro
'


Dim teamMember As Range
Dim autoRange As Range
Dim xPath As Range
Dim lastRow As Range
Dim colrng As Range
Dim t As Integer
Dim devTrack As ArrayList
Dim colnum As Integer

Set teamMember = ActiveWorkbook.Worksheets("").Range("F4")

Set xPath = ActiveWorkbook.Worksheets("QS Update Requirements").Range("F5")




Dim x As Workbook
Dim Y As Workbook

''## Open both workbooks first:
Set x = Workbooks.Open(xPath)
Set Y = Workbooks.Open("https://emergentbiosolutions-my.sharepoint.com/personal/boltonw_ebsi_com/Documents/Desktop/actively working on/New folder/EFV Quality Systems Tracker (test CCCOOOOPPYYYY).xlsm")
Windows( _
"Weekly Report).xlsm" _
).Activate
ActiveSheet.Range("$A$1:$L$43").AutoFilter Field:=11, Criteria1:= _
teamMember
Range("A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Workbooks("EFV Tracker (test CCCOOOOPPYYYY).xlsm").Sheets("Historian ").Activate
Range("A1").Select
ActiveSheet.Paste

Application.CutCopyMode = False

'Close x:
x.Close

'Set devTrack = New ArrayList
'devTrack.Add Workbooks("EFV Quality Systems Tracker (test CCCOOOOPPYYYY).xlsm").Sheets("Historian deviation").Range("B2: B & Sheets("Deviation tracker").Columns.Count.End)


For i = 1 To 7


Range("A" & i).Select



Set colnum = Sheets("Deviation tracker").Columns.Count.End(xlToLeft).Offset + 1


Range("A" & i).Select
Selection.Copy
Sheets("Deviation tracker").Select

Range("columnrng" & 3).Select

ActiveSheet.Paste
Sheets("Historian deviation").Select
Range("B" + i).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Deviation tracker").Select
Range.Cells(4, columnrng).Select
ActiveSheet.Paste
Application.CutCopyMode = False

Sheets("Historian deviation").Select
Range("D" + i).Select
Selection.Copy
Sheets("Deviation tracker").Select
Range.Cells(5, columnrng).Select
ActiveSheet.Paste

Sheets("Historian deviation").Select
Range("K1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Deviation tracker").Select
Range.Cells(6, columnrng).Select
ActveSheet.Paste


Sheets("Historian deviation").Select
Range("O1:O17").Select
Selection.Copy
Sheets("Deviation tracker").Select
Range.Cells(8, columnrng).Select
ActveSheet.Paste


Sheets("Historian deviation").Select
Range("O1:O17").Select


Next



End Sub
[/CODE]


Right now its saying i dont have a object for Set colnum = Sheets("Deviation tracker").Columns.Count.End(xlToLeft).Offset + 1
 

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,215,040
Messages
6,122,806
Members
449,095
Latest member
m_smith_solihull

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