Improvised
In the Players Handbook, there are two main examples of standard weapons becoming improvised weapons.
[PHB, p. 147] If you use a weapon that has the ammunition property to make a melee attack, you treat the weapon as an improvised weapon (see "Improvised Weapons" later in the section). A sling must be loaded to deal any damage when used in this way.
and
[PHB, p. 148, in the section on Improvised Weapons] If a character uses a ranged weapon to make a melee attack, or throws a melee weapon that does not have the thrown property, it also deals 1d4 damage. An improvised thrown weapon has a normal range of 20 feet and a long range of 60 feet.
Thus, weapons that have the ammunition property used to make melee attacks, or weapons that are thrown which do not have the thrown property, count as Improvised Weapons. In each case, the weapons would follow all the rules for improvised weapons. (For example, you would not use your proficiency bonus to attack with them unless you have the Tavern Brawler Feat). Since "the DM assigns a damage type appropriate to the object" (PHB, p. 148) for an improvised weapon, the damage type would depend on your manner of attack.
Seeing the comments on your question, you may be referring to making a ranged attack against an enemy that is within 5 feet of you. If this is the case, see "Ranged Attacks in Close Combat" (PHB, p. 195).
Improvised Weapons are not a subset of Melee or Ranged Weapons, but they are Weapons.
Let's begin with the identification of the Improvised Weapon as a Weapon (and not an object or Armor, or anything else). Jeremy Crawford supports this:
An improvised weapon is, indeed, a weapon, but only the moment it's used as such. A chair/shield/etc isn't a weapon otherwise.
What type of weapon is it? An Improvised Weapon
Chapter 5 of the PHB (page 149) contains a list of common Melee and Ranged Weapons. That is the list for things that require Melee Weapon or Ranged Weapon attacks. Existing items within the ruleset that are not listed here would likely not qualify, but items that are not listed which have similarities would (i.e. katana as longsword). A shield is not on the list, but is under Armor.
Whether or not Improvised Weapons are on the list is the exact question being asked here.
Jeremy Crawford takes a bit about the object vs process here:
In D&D, a weapon is an object. A weapon attack is a process. Sometimes the rules let you use nonweapons to engage in that process
An Improvised Weapon is neither a Melee Weapon nor a Ranged Weapon (from the list previously defined on page 165.) It is it's own category that can be found pages 147-8 in the PHB.
Type of Weapon is different from type of Attack
While you may make a Melee or Ranged Attack with one, it does not turn the Improvised Weapon into a Melee or Ranged Weapon. It is just a Melee or Ranged Attack that is made with an Improvised Weapon.
Crawford covers this in the following exchange:
A melee weapon attack is a melee attack with a weapon.
and the following exchange with a user (the first quote):
@Sebkha Not to be confused with: an attack with a melee weapon.
@JeremyECrawford That's correct, since an attack with a melee weapon can be a ranged attack if you throw it
Proficiency points the way towards a different Type than Melee/Ranged
If an Improvised Weapon is ALWAYS either a Simple or Martial Melee or Ranged weapon, then there would have been no need for this clarification on proficiency in the Improvised Weapons rules:
In many cases, an improvised weapon is similar to an actual weapon and can be treated as such. For example, a table leg is akin to a club. At the DM’s option, a character proficient with a weapon can use a similar object as if it were that weapon and use his or her proficiency bonus.
If it was a given that an Improvised Weapon was always a Simple or Martial Melee/Ranged weapon, then proficiency would always apply. In addition, the only way to gain proficiency in an Improvised Weapon is through the Tavern Brawler feat. This would be unnecessary if Improvised Weapons were classed as part of Melee/Ranged as your proficiency would already be granted if that was covered by your race/class.
Crawford discusses this a bit here:
A shield certainly isn't a weapon, but like many things, it can be used as an improvised weapon.
There is clearly a differentiation in Crawford's eye between Weapons and Improvised Weapons.
Best Answer
Only as an improvised weapon.
From the description of improvised weapons in the rules (PHB, p. 147-148):
Rules designer Jeremy Crawford unofficially confirms this ruling on Twitter:
It seems clear that the intent is that any usage of a ranged weapon to make a melee attack (i.e. hitting them with the weapon itself) would involve your ranged weapon being treated as an improvised melee weapon, so the attack would follow the rules for improvised weapons. While the DM could house-rule otherwise, this is how such situations are handled by the rules.