Hello
I have data that I manually scrape every day. This data needs to be organized into different sheets.
I have a workbook with different sheets.
The source worksheet of the data is "Today's Work"
The target worksheet is "IQ Eligible"
In Today's Work, column A contains information in the following format: random_text_IQ-eligible , where the random text changes for each cell.
The important thing to know is that not all the data will end in "IQ-eligible".
The VBA macro needs to be able to find and isolate the rows (A:C) that contain "IQ-eligible" and then copy them over to worksheet "IQ Work"
How would we go about this?
I have some VBA code that is being used for a different purpose, but some of it can be recycled into building this new macro.
I have data that I manually scrape every day. This data needs to be organized into different sheets.
I have a workbook with different sheets.
The source worksheet of the data is "Today's Work"
The target worksheet is "IQ Eligible"
In Today's Work, column A contains information in the following format: random_text_IQ-eligible , where the random text changes for each cell.
The important thing to know is that not all the data will end in "IQ-eligible".
The VBA macro needs to be able to find and isolate the rows (A:C) that contain "IQ-eligible" and then copy them over to worksheet "IQ Work"
How would we go about this?
I have some VBA code that is being used for a different purpose, but some of it can be recycled into building this new macro.
VBA Code:
Sub Test()
Dim c As Range
Dim d As Long
Dim Source As Worksheet
Dim Target As Worksheet
Set Source = ActiveWorkbook.Worksheets("Today's Work")
Set Target = ActiveWorkbook.Worksheets("Bin Work")
For Each c In Source.Range("C1:C" & Source.Cells(Rows.Count, 1).End(xlUp).Row)
If c = "Bin" Then
Source.Range("A" & c.Row & ":C" & c.Row).Copy
Target.Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteAll
Source.Range("A" & c.Row & ":C" & c.Row).ClearContents
End If
Next c
For d = Source.Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If Application.WorksheetFunction.CountA(Source.Range("A" & d & ":" & "C" & d)) = 0 Then
Source.Range("A" & d & ":C" & d).Delete Shift:=xlUp
End If
Next d
End Sub