Hi I am new to VBA and beyond frustrated,
I have list A in a workbook A in Sheet A. And I have a list B in wookbook A in sheet B.
I need to run VBA so that It opens up a separate workbook X (only has 1 sheet), looks through the list in list A and finds the corresponding characters from list A in the workbook X then deletes the row it is found in.
And then again for List B, It is going to open a separate wookbook Y (only has 1 sheet), looks through list in List B and finds the corresponding character from list B in the workbook Y then deletes the row it is found in.
I have gotten this far but for whatever reason I keep getting an error message:
Sub Remover()
Dim Uid As Long, Lid As Long, U As Range, L As Range
Dim Uwbk As Workbook, Lwbk As Workbook
Dim Ws As Worksheet, Uws As Worksheet, Lws As Worksheet, UxWs As Worksheet, LxWs As Worksheet
Set Uws = ThisWorkbook.Sheets("List A")
Set Lws = ThisWorkbook.Sheets("List B")
Set Uwbk = Workbooks.Open("WorkbookX.csv")
Set Lwbk = Workbooks.Open("WorkbookY.csv")
Set UxWs = Uwbk.Worksheets("Sheet 1")
Set LxWs = Lwbk.Worksheets("Sheet 1")
For Uid = UxWs.Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
Set U = Uws.Columns("A").Find(UxWs.Cells(i, 1).Value)
If Not U Is Nothing Then Rows(i).Delete
Next
For Lid = LxWs.Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
Set L = Lws.Columns("A").Find(LxWs.Cells(i, 1).Value)
If Not L Is Nothing Then Rows(i).Delete
Next
End Sub
This doesn't work.
Can someone please help me out here?
Thank you,
I have list A in a workbook A in Sheet A. And I have a list B in wookbook A in sheet B.
I need to run VBA so that It opens up a separate workbook X (only has 1 sheet), looks through the list in list A and finds the corresponding characters from list A in the workbook X then deletes the row it is found in.
And then again for List B, It is going to open a separate wookbook Y (only has 1 sheet), looks through list in List B and finds the corresponding character from list B in the workbook Y then deletes the row it is found in.
I have gotten this far but for whatever reason I keep getting an error message:
Sub Remover()
Dim Uid As Long, Lid As Long, U As Range, L As Range
Dim Uwbk As Workbook, Lwbk As Workbook
Dim Ws As Worksheet, Uws As Worksheet, Lws As Worksheet, UxWs As Worksheet, LxWs As Worksheet
Set Uws = ThisWorkbook.Sheets("List A")
Set Lws = ThisWorkbook.Sheets("List B")
Set Uwbk = Workbooks.Open("WorkbookX.csv")
Set Lwbk = Workbooks.Open("WorkbookY.csv")
Set UxWs = Uwbk.Worksheets("Sheet 1")
Set LxWs = Lwbk.Worksheets("Sheet 1")
For Uid = UxWs.Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
Set U = Uws.Columns("A").Find(UxWs.Cells(i, 1).Value)
If Not U Is Nothing Then Rows(i).Delete
Next
For Lid = LxWs.Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
Set L = Lws.Columns("A").Find(LxWs.Cells(i, 1).Value)
If Not L Is Nothing Then Rows(i).Delete
Next
End Sub
This doesn't work.
Can someone please help me out here?
Thank you,