ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   vba code (https://www.excelbanter.com/excel-discussion-misc-queries/173704-vba-code.html)

EricBB

vba code
 
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.

Mike H

vba code
 
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

"EricBB" wrote:

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.


seb

vba code
 
Hi,

Maybe the question was how to hide unhide sheets ?

seb.



EricBB

vba code
 
Hi Mike,

Thanks for the response.

Exactly, as what you have written.

Pls. help me with this.


"Mike H" wrote:

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

"EricBB" wrote:

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.


Daryl Fagala

vba code
 
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


"EricBB" wrote:

Hi Mike,

Thanks for the response.

Exactly, as what you have written.

Pls. help me with this.


"Mike H" wrote:

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

"EricBB" wrote:

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.


Rick Rothstein \(MVP - VB\)

vba code
 
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


"Daryl Fagala" wrote in message
...
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


"EricBB" wrote:

Hi Mike,

Thanks for the response.

Exactly, as what you have written.

Pls. help me with this.


"Mike H" wrote:

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

"EricBB" wrote:

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.




All times are GMT +1. The time now is 08:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com