From the Super Mario Wiki
The Yellow Switch is one of four colored switches that appeared in Super Mario World. Activating this switch will turn all yellow outlined blocks into solid yellow ! blocks. Each yellow ! block contains a Super Mushroom, regardless of Mario's power-up.
Yellow Switches are also found in the Vim Factory during Mario & Luigi: Partners in Time. Around two to three appear in the game. They have two squares on them, meaning that both Baby Mario and Baby Luigi must stand on the switch to open a door. They are a variation of the common Blue Switch.
A Yellow Switch also makes an appearance in Super Mario Advance 4: Super Mario Bros. 3 as a Japan-exclusive e-Reader card. Released in Series 1 in Japan, it gives Luigi his Scuttle ability from Super Mario Bros. 2, and makes his fireballs bounce higher, as in Super Mario World: Super Mario Advance 2. It is permanently on in World-e.