Here is a website with a list of books in a relatively simple format.
http://www.autism-resources.com/autism.bib
I copied the list into excel, and each group of % symbols is a listing for a book, with different details like keywords and such. for instance %T = titles.
I want to create a macro to search through the list and copy every row that starts with “% whatever marker i choose” to the B column
Here is code I found and changed to do pretty close to what I want, except I keep getting an error.
Sub SearchForString()
Dim LSearchRow As Integer
Dim LCopyToRow As Integer
Dim celltxt As String
On Error GoTo Err_Execute
LSearchRow = 1
LCopyToRow = 1
While Len(Range("A" & CStr(LSearchRow)).Value) > 0
celltxt = ActiveSheet.Range("A" & CStr(LSearchRow)).Value
If InStr(1, celltxt, "%T") > 0 Then
Cells("A" & CStr(LSearchRow)).Select
Selection.Copy
Cells("B" & CStr(LCopyToRow)).Select
ActiveCell.Paste
LCopyToRow = LCopyToRow + 1
End If
LSearchRow = LSearchRow + 1
Wend
Application.CutCopyMode = False
Range("A1").Select
MsgBox "All matching data has been copied."
Exit Sub
Err_Execute:
MsgBox "An error occurred."
End Sub
Also, I believe the:
While Len(range....) > 0
is set to keep looping until the active cell is empty, but the data is separated by a blank row for each book. I can go through and delete the empty rows, but is there a way to get around that with code?
See if this works for you. I used a Web Query and downloaded the data to A1 on sheet “Raw”