First of all it's important to point out that there is no modulation in this exercise. There are many chords that do not belong to the key of E major, but they all just pass by, leading to the next chords and so on until we've finally returned to E major. No stable new tonal center is being established.
Second, even though there is no modulation, it is not meaningful to analyze all chords as being part of E major. E.g. the A#m7 chord in measure 5 is not a #IVm7 chord, because this is not its function. Its function is just being part of a II-V progression leading to the G#m7 chord in measure 7. For the same reason, the D#7 chord in measure 6 is definitely not a VII7, as written on your sheet.
There are several approaches to such an analysis, but I'll show you how I see (and hear) this (quite artificial) progression:
The first four chords are a classic turn-around. You could write that down as Imaj7 VI7 II7 V7
, but a better explanation is in fact Imaj7 V7/II V7/V V7
, where V7/X
means the secondary dominant for the degree X
, so V7/II
is the secondary dominant for the II chord. Note that the actual II chord doesn't come (it should be F#m7), but this doesn't matter, because the secondary dominant does resolve to a chord with root F#, which itself is another secondary dominant for the next chord.
Now we said that the B7 chord is the V7. True, however, it leads to A#m7, so even though its a priori analysis (i.e., not knowing what comes after it) is V7, its a posteriori analysis (knowing where it leads to) should be different, because it functions as a tritone substitute for the secondary dominant of A#m7. You can call it subV7
with an arrow attached to it leading to the next chord.
Next it's important to know that any dominant chord may be preceded by its related IIm7 chord. Together they form a II-V unit which you see all over the place. Concerning II-V units, please also have a look at this answer. The V can resolve down a perfect fifth, or it can resolve down a half step if its a subV. It can also resolve to the next V7 chord, even though the latter is preceded by its related II chord. An example of the last case is the C7 chord in bar 14, which does not directly resolve to Cm7, but to the F7 chord in the next measure. In this case the Cm7 just delays the resolution.
From measure 5 till measure 18 you mainly have secondary dominants, which sometimes appear with their related II chord, and which are sometimes replaced by their tritone substitute (and the related II chord). So starting from measure 5 you have
(IIm7 V7) -> sub(IIm7 V7) -> Cmaj7 (you can call it bVImaj7, but it's not really relevant), V7 -> subV7 -> sub(IIm7 V7) -> VIm7, V7 (leading to the next V7, not to the IIm7) -> sub(IIm7 V7) -> sub(IIm7 V7) -> IIIm7, V7/II -> IIm7 -> V7 -> Imaj7, VIm7, IIm7, V7