store the field name in an array at backend
say
Dim MyArray(99) as string
here store value for each fieldName
MyArray(1) = 'Field1name'
MyArray(2) = 'Field2name'
in the frontend
now create array of checkbox for each field
and then loop though a sql query for ticked checkbox fields and pass the build up query to transferspreadsheet function