You need to provide specific information. If you mean you have a 6th gen cpu and would like to replace it with a 7th generation then yes. Just go to the motherboard makers web site, look at the supported CPU's section for the motherboard, if the CPU is on that list grab the latest BIOS, flash it, and you are all set to replace the CPU with a 7th gen model.
If you are buying both new just get the 7th gen motherboard like an H270 or B250 to go with the cpu.