Every layer has a Boolean property called IsVisible. The below macro toggles this property between True and False.