Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jan Jan is offline
external usenet poster
 
Posts: 159
Default Need Help - save sheet then hide when....

I am using Excel 2003 and I'm a novice with VBA.
I have 2 worksheets(for now): Steps and Routes.

I plan to have several command buttons on the Steps worksheet that when the
user clicks on the button, it unhides a worksheet and places the cursor in a
specific cell for that worksheet to allow the user to begin entering required
data. The macro I created for the button works so far to select the "Routes"
worksheet.

When the user is finish entering data and selects the "Steps" worksheet, I
want the Routes worksheet to be saved and then hidden. Can someone help me
with the syntax to accomplish this event?

TIA

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Need Help - save sheet then hide when....

Bearing in mind that you can't save an individual worksheet - you have to
save the whole workbook - place this code in the ThisWorkbook code sheet in
your VBA project. It traps the event where a sheet is deactivated.

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
If Sh.Name = "Routes" Then
Sh.Visible = False
ActiveWorkbook.Save
End If
End Sub

Regards
Rowan

"Jan" wrote:

I am using Excel 2003 and I'm a novice with VBA.
I have 2 worksheets(for now): Steps and Routes.

I plan to have several command buttons on the Steps worksheet that when the
user clicks on the button, it unhides a worksheet and places the cursor in a
specific cell for that worksheet to allow the user to begin entering required
data. The macro I created for the button works so far to select the "Routes"
worksheet.

When the user is finish entering data and selects the "Steps" worksheet, I
want the Routes worksheet to be saved and then hidden. Can someone help me
with the syntax to accomplish this event?

TIA

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Need Help - save sheet then hide when....

Why not just use

--
Private Sub WorkSheet_Deactivate()
Me.Visible = xlHidden
ActiveWorkbook.Save
End Sub

as a worksheet event?


HTH

RP
(remove nothere from the email address if mailing direct)


"Rowan" wrote in message
...
Bearing in mind that you can't save an individual worksheet - you have to
save the whole workbook - place this code in the ThisWorkbook code sheet

in
your VBA project. It traps the event where a sheet is deactivated.

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
If Sh.Name = "Routes" Then
Sh.Visible = False
ActiveWorkbook.Save
End If
End Sub

Regards
Rowan

"Jan" wrote:

I am using Excel 2003 and I'm a novice with VBA.
I have 2 worksheets(for now): Steps and Routes.

I plan to have several command buttons on the Steps worksheet that when

the
user clicks on the button, it unhides a worksheet and places the cursor

in a
specific cell for that worksheet to allow the user to begin entering

required
data. The macro I created for the button works so far to select the

"Routes"
worksheet.

When the user is finish entering data and selects the "Steps" worksheet,

I
want the Routes worksheet to be saved and then hidden. Can someone help

me
with the syntax to accomplish this event?

TIA



  #4   Report Post  
Posted to microsoft.public.excel.programming
Jan Jan is offline
external usenet poster
 
Posts: 159
Default Need Help - save sheet then hide when....

I've entered the code as provided in the This workbook, but nothing happens.
Unlike the command buttons on the Steps worksheet that have a specific macro
to make then work; what makes this code process when the user leaves the
"Routes" worksheet and clicks on the worksheet tab to return to the "Steps"
worksheet. Sorry, but I don't know this stuff very well.

"Rowan" wrote:

Bearing in mind that you can't save an individual worksheet - you have to
save the whole workbook - place this code in the ThisWorkbook code sheet in
your VBA project. It traps the event where a sheet is deactivated.

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
If Sh.Name = "Routes" Then
Sh.Visible = False
ActiveWorkbook.Save
End If
End Sub

Regards
Rowan

"Jan" wrote:

I am using Excel 2003 and I'm a novice with VBA.
I have 2 worksheets(for now): Steps and Routes.

I plan to have several command buttons on the Steps worksheet that when the
user clicks on the button, it unhides a worksheet and places the cursor in a
specific cell for that worksheet to allow the user to begin entering required
data. The macro I created for the button works so far to select the "Routes"
worksheet.

When the user is finish entering data and selects the "Steps" worksheet, I
want the Routes worksheet to be saved and then hidden. Can someone help me
with the syntax to accomplish this event?

TIA

  #5   Report Post  
Posted to microsoft.public.excel.programming
Jan Jan is offline
external usenet poster
 
Posts: 159
Default Need Help - save sheet then hide when....

This worked once I discovered where exactly to place the code to get it to
execute. I needed to right click on the "Routes" tab, select View code and
enter the syntax.

Thank you.



"Bob Phillips" wrote:

Why not just use

--
Private Sub WorkSheet_Deactivate()
Me.Visible = xlHidden
ActiveWorkbook.Save
End Sub

as a worksheet event?


HTH

RP
(remove nothere from the email address if mailing direct)


"Rowan" wrote in message
...
Bearing in mind that you can't save an individual worksheet - you have to
save the whole workbook - place this code in the ThisWorkbook code sheet

in
your VBA project. It traps the event where a sheet is deactivated.

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
If Sh.Name = "Routes" Then
Sh.Visible = False
ActiveWorkbook.Save
End If
End Sub

Regards
Rowan

"Jan" wrote:

I am using Excel 2003 and I'm a novice with VBA.
I have 2 worksheets(for now): Steps and Routes.

I plan to have several command buttons on the Steps worksheet that when

the
user clicks on the button, it unhides a worksheet and places the cursor

in a
specific cell for that worksheet to allow the user to begin entering

required
data. The macro I created for the button works so far to select the

"Routes"
worksheet.

When the user is finish entering data and selects the "Steps" worksheet,

I
want the Routes worksheet to be saved and then hidden. Can someone help

me
with the syntax to accomplish this event?

TIA






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Need Help - save sheet then hide when....

Sorry, should have told you that.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jan" wrote in message
...
This worked once I discovered where exactly to place the code to get it to
execute. I needed to right click on the "Routes" tab, select View code

and
enter the syntax.

Thank you.



"Bob Phillips" wrote:

Why not just use

--
Private Sub WorkSheet_Deactivate()
Me.Visible = xlHidden
ActiveWorkbook.Save
End Sub

as a worksheet event?


HTH

RP
(remove nothere from the email address if mailing direct)


"Rowan" wrote in message
...
Bearing in mind that you can't save an individual worksheet - you have

to
save the whole workbook - place this code in the ThisWorkbook code

sheet
in
your VBA project. It traps the event where a sheet is deactivated.

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
If Sh.Name = "Routes" Then
Sh.Visible = False
ActiveWorkbook.Save
End If
End Sub

Regards
Rowan

"Jan" wrote:

I am using Excel 2003 and I'm a novice with VBA.
I have 2 worksheets(for now): Steps and Routes.

I plan to have several command buttons on the Steps worksheet that

when
the
user clicks on the button, it unhides a worksheet and places the

cursor
in a
specific cell for that worksheet to allow the user to begin entering

required
data. The macro I created for the button works so far to select the

"Routes"
worksheet.

When the user is finish entering data and selects the "Steps"

worksheet,
I
want the Routes worksheet to be saved and then hidden. Can someone

help
me
with the syntax to accomplish this event?

TIA






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save, save as, page setup dimmed out in unprotected excel sheet? ccKeithJ Excel Discussion (Misc queries) 3 December 14th 07 07:07 PM
Create Sheet, Hide Sheet Dave Excel Discussion (Misc queries) 2 October 30th 07 03:40 PM
Hide a Sheet AQ Mahomed Excel Programming 3 June 17th 04 04:27 PM
hide sheet Jeff Excel Programming 1 June 9th 04 07:55 PM
hide sheet? uncheck sheet tabs? or ??? NetComm888 Excel Programming 1 February 10th 04 04:38 AM


All times are GMT +1. The time now is 08:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"