vba code

E

EricBB

hi everybody,

i have sheet1, sheet2 & sheet3 in a workbook. what i want is, if i save the
file i want to hide sheet2 & sheet3, so only sheet1 is visible. after the
saving i want to show again the hide sheets.

pls. help.
 
M

Mike H

Hi,

So sheet2 & sheet3 become hidden when you save but as soon as the save is
complete they become visible again. I must have misunderstood, please clarify.

Mike
 
E

EricBB

Hi Mike,

Thanks for the response.

Exactly, as what you have written.

Pls. help me with this.
 
D

Daryl Fagala

I'm still not sure I understand you, probably because I can't imagine why
you'd want to do it. So, at the risk of being completely off-target, try the
following:

Sheets("Sheet2").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Sheet3").Select
ActiveWindow.SelectedSheets.Visible = False
ActiveWorkbook.Save
Sheets("Sheet2").Visible = True
Sheets("Sheet3").Visible = True
End Sub
 
R

Rick Rothstein \(MVP - VB\)

You don't need to Select each sheet before making it invisible...

Sheets("Sheet2").Visible = False
Sheets("Sheet3").Visible = False
ActiveWorkbook.Save
Sheets("Sheet2").Visible = True
Sheets("Sheet3").Visible = True

Rick
 
Top