Si necesita ocultar ciertas columnas usando un botón, puede usar este código. Incluso cambiará el texto del botón de comando a Ocultar columnas y luego lo cambiará nuevamente a Mostrar columnas.

Sub Hide_C ()

Atenuar C_ell como rango ActiveSheet.Shapes.Range (Array («Botón 2»)). Seleccione si Selection.Characters.Text = «Mostrar columnas», luego Columns.Hidden = False Selection.Characters.Text = «Ocultar columnas»

Más para cada C_ell en el rango («B1», Celdas (1, Columnas.Cuenta) .End (xlToLeft))

Si C_ell = «x» Entonces C_ell.Columns.Hidden = Verdadero Siguiente Selection.Characters.Text = «Mostrar columnas»

End If Range («A2»). Seleccione End Sub