vba code

  • Thread starter Thread starter EricBB
  • Start date Start date
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.
 
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
 
Hi Mike,

Thanks for the response.

Exactly, as what you have written.

Pls. help me with this.
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top