How to copy the selected range of cells based on color using Macros

Hi Team,

Can anyone help me on how to split the selected range of cells using macros and convert them in to PDF.And list of details will be dynamic not fixed range of rows.
image
I want to split as below based on heading color:
Page 1
image
Page 2
image
And convert them in to PDF.

Regards,
Rajesh