Morning all, I'm an absolute newbie with Macros and have also received a lot of help from previous Postings. I just need this bit of code adapted slightly.
So I have multiple worksheets and I need to copy them into one overall sheet. I have captured some script from another thread, see below. This will copy a line IF a text string is present within column A on the various sheets matches the text string within B1 on the Summary Sheet. What I need to do instead is to copy a line if Col B has text on the various sheets AND to start the search from Row 6.
Any ideas?:
So I have multiple worksheets and I need to copy them into one overall sheet. I have captured some script from another thread, see below. This will copy a line IF a text string is present within column A on the various sheets matches the text string within B1 on the Summary Sheet. What I need to do instead is to copy a line if Col B has text on the various sheets AND to start the search from Row 6.
Any ideas?:
Code:
Sub Summary()
Dim WkSht As Worksheet
Dim r As Integer
For Each WkSht In ThisWorkbook.Worksheets
If WkSht.Name <> "SUMMARY" Then
For r = 1 To 1000
'This will check the first 1000 rows of each sheet
If WkSht.Range("A" & r).Value = Sheets("Summary").Range("B1").Value Then
WkSht.Rows(r & ":" & r).Copy
Sheets("Summary").Range("A65536").End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteAll
Sheets("Summary").Range("B" & Sheets("Summary").Range("A65536").End(xlUp).Row).Value = WkSht.Name
Exit For
End If
Next r
End If
Next WkSht
End Sub
Last edited by a moderator: