Wow, so that was a switch loop, and you can't do that with a switch loop.
Here's the problem. Part of both the building and electrical codes is that there must be ONE light switch in the usual place in a room, and that switch must actually operate a light. You're not allowed to build a room so that people must use desk/floor lamps and switch them on at the lamp.
An allowed alternate is that the switch can operate a receptacle, into which you plug in a light. You have that right now.
You cannot eliminate the last switch operating a light. The switch has to operate a light.
So if this is the only switch in the room, and this is a fan-only no light, that plus the switch-loop problem brings this carnival ride to a screeching halt. You cannot do this; you are done. You must reroute the fan power to a receptacle.
If it is a fan+light, then you can wire it so the switch always turns on the light, and if the light is on, the fan can operate. That is allowable. We will proceed on that basis.
-----
The "switch loop" to the light must be changed to a normal power feed. Down at the receptacle it will have a white wire with some blacks. That identfiies which cable it is. Remove both black and white from where they are right now. Then, put white with the other whites, and black with the other blacks, using normal splicing methods (pigtails, wire nuts, all that jazz). If you want to use the recep as a splice block and you know how to do that, have a field day, but you'll need to know how "breaking off tabs" works.
Any black or colored tape on the white wire must be removed since it'll be a neutral now.
OK, now at the switch, white is neutral and black is always hot. Don't have them be on the switch anymore!
Now, the 2 whites get nutted to each other. The two blacks go to the switch.
And we're done. If you want to get fancy, mark the black on your new cable red on both ends, since it is switched-hot.