I have a Static Data Sheet with Names of Countries in Column A [ this list will increase in time]
In the Raw Data Sheet in Column P are the names of countries.
If the countries in column P in the Raw Data Tab are in the Static Data table [in Sheet named Static Data] I need to create a new sheet, if one does not already exist.
I then need to copy the entire rows from the Raw Data tab onto the respective [named] Sheets and include the header row in each sheet.
So if Spain is in P10, P11, P12, P13 in the Raw Data Sheet, I need to copy both the header from the Raw Data Sheet and Rows 10,11,12,13 to the sheet named Spain
Rgonzo1971 provided me with the below code recently but unfortunately the user criteria changed.
Set SrcSheet = ActiveSheet
For Idx = 2 To Range("M2:M" & Range("M" & Rows.Count).End(xlUp).Row).Count + 1
If SrcSheet.Range("M" & Idx).Value <> "" Then
Set DestSh = Worksheets.Add(, Worksheets(Worksheets.Count))
DestSh.Name = SrcSheet.Range("M" & Idx).Value
Idx2 = Idx
While SrcSheet.Range("M" & Idx).Offset(1) = SrcSheet.Range("M" & Idx)
Idx = Idx + 1
SrcSheet.Range(Idx & ":" & Idx2).Copy DestSh.Range("2:2")
Thanks in advance