Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Issue with marco for entire workbook

I am trying to set a simple macro that will hide 1 certain column ('J', in
this case) on each worksheet with my workbook. At the same time, I would
like it to close a particular worksheet (the last one in the string of them
all - about 14 worksheets within workbook). Need these set to 'save to web'
for this database I have going. I have tried this a few methods to include
keeping it relative, but no luck. I can do them individually for each
worksheet, but can not for the lump some of them with one simple macro. Got
to be something simple I am missing. Checked through my books with no luck.
So if you could, would be nice to fill me in with what I am doing wrong and
how do this effectively. Thanks much.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 185
Default Issue with marco for entire workbook

Mark

I'm struggling to understand what you mean by 'close' the last worksheet and
'save to web for this database', but to iterate through all your worksheets,
hiding column 'J' and then *hide* the last sheet, you could do something
like

Sub HideJAndLastSheet()
Dim x As Integer, y As Integer
Dim wks As Worksheet
x = ThisWorkbook.Worksheets.Count
y = 1
For Each wks In ThisWorkbook.Worksheets
wks.Columns("J").Hidden = True
If y = x Then wks.Visible = xlSheetHidden
y = y + 1
Next wks
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
web:
www.nickhodge.co.uk
web: www.excelusergroup.org




"Mark G." wrote in message
...
I am trying to set a simple macro that will hide 1 certain column ('J', in
this case) on each worksheet with my workbook. At the same time, I would
like it to close a particular worksheet (the last one in the string of
them all - about 14 worksheets within workbook). Need these set to 'save
to web' for this database I have going. I have tried this a few methods to
include keeping it relative, but no luck. I can do them individually for
each worksheet, but can not for the lump some of them with one simple
macro. Got to be something simple I am missing. Checked through my books
with no luck. So if you could, would be nice to fill me in with what I am
doing wrong and how do this effectively. Thanks much.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Issue with marco for entire workbook

While I am new to VBA, do I just resave this as a cut and paste? The save
for web is just an option I use under the file menu as I upload this info to
a website. I meant hide the last worksheet, not close.


"Nick Hodge" wrote in message
...
Mark

I'm struggling to understand what you mean by 'close' the last worksheet
and 'save to web for this database', but to iterate through all your
worksheets, hiding column 'J' and then *hide* the last sheet, you could do
something like

Sub HideJAndLastSheet()
Dim x As Integer, y As Integer
Dim wks As Worksheet
x = ThisWorkbook.Worksheets.Count
y = 1
For Each wks In ThisWorkbook.Worksheets
wks.Columns("J").Hidden = True
If y = x Then wks.Visible = xlSheetHidden
y = y + 1
Next wks
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
web:
www.nickhodge.co.uk
web: www.excelusergroup.org




"Mark G." wrote in message
...
I am trying to set a simple macro that will hide 1 certain column ('J',
in this case) on each worksheet with my workbook. At the same time, I
would like it to close a particular worksheet (the last one in the string
of them all - about 14 worksheets within workbook). Need these set to
'save to web' for this database I have going. I have tried this a few
methods to include keeping it relative, but no luck. I can do them
individually for each worksheet, but can not for the lump some of them
with one simple macro. Got to be something simple I am missing. Checked
through my books with no luck. So if you could, would be nice to fill me
in with what I am doing wrong and how do this effectively. Thanks much.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Issue with marco for entire workbook

What I got now seems to work fine and here it is:

Sub HideJAndLastSheet()
Dim x As Integer, y As Integer
Dim wks As Worksheet
x = ThisWorkbook.Worksheets.Count
y = 1
For Each wks In ThisWorkbook.Worksheets
wks.Columns("J").Hidden = True
If y = x Then wks.Visible = xlSheetHidden
y = y + 1
Next wks
ActiveWorkbook.Save
Range("C16").Select
Application.MacroOptions Macro:="HideJAndLastSheet", Description:= _
"Hide Column J in all and last worksheet.", ShortcutKey:="H"
Application.Run "'HW-Collection.xls'!HideJAndLastSheet"
Application.Run "'HW-Collection.xls'!HideJAndLastSheet"
Range("C10").Select
Application.Run "'HW-Collection.xls'!HideJAndLastSheet"
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("Unimogs").Select
Range("D22").Select
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("Ferrari").Select
Range("E25").Select
Application.Run "'HW-Collection.xls'!HideJAndLastSheet"
Range("E24").Select
End Sub

But, now how do I set this up so that it will unhide those columns and
restore the last worksheet?

Thanks much.


"Nick Hodge" wrote in message
...
Mark

I'm struggling to understand what you mean by 'close' the last worksheet
and 'save to web for this database', but to iterate through all your
worksheets, hiding column 'J' and then *hide* the last sheet, you could do
something like

Sub HideJAndLastSheet()
Dim x As Integer, y As Integer
Dim wks As Worksheet
x = ThisWorkbook.Worksheets.Count
y = 1
For Each wks In ThisWorkbook.Worksheets
wks.Columns("J").Hidden = True
If y = x Then wks.Visible = xlSheetHidden
y = y + 1
Next wks
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
web:
www.nickhodge.co.uk
web: www.excelusergroup.org




"Mark G." wrote in message
...
I am trying to set a simple macro that will hide 1 certain column ('J',
in this case) on each worksheet with my workbook. At the same time, I
would like it to close a particular worksheet (the last one in the string
of them all - about 14 worksheets within workbook). Need these set to
'save to web' for this database I have going. I have tried this a few
methods to include keeping it relative, but no luck. I can do them
individually for each worksheet, but can not for the lump some of them
with one simple macro. Got to be something simple I am missing. Checked
through my books with no luck. So if you could, would be nice to fill me
in with what I am doing wrong and how do this effectively. Thanks much.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Issue with marco for entire workbook

Can anyone offer any help here?


"Mark G." wrote in message
...
What I got now seems to work fine and here it is:

Sub HideJAndLastSheet()
Dim x As Integer, y As Integer
Dim wks As Worksheet
x = ThisWorkbook.Worksheets.Count
y = 1
For Each wks In ThisWorkbook.Worksheets
wks.Columns("J").Hidden = True
If y = x Then wks.Visible = xlSheetHidden
y = y + 1
Next wks
ActiveWorkbook.Save
Range("C16").Select
Application.MacroOptions Macro:="HideJAndLastSheet", Description:= _
"Hide Column J in all and last worksheet.", ShortcutKey:="H"
Application.Run "'HW-Collection.xls'!HideJAndLastSheet"
Application.Run "'HW-Collection.xls'!HideJAndLastSheet"
Range("C10").Select
Application.Run "'HW-Collection.xls'!HideJAndLastSheet"
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("Unimogs").Select
Range("D22").Select
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("Ferrari").Select
Range("E25").Select
Application.Run "'HW-Collection.xls'!HideJAndLastSheet"
Range("E24").Select
End Sub

But, now how do I set this up so that it will unhide those columns and
restore the last worksheet?

Thanks much.


"Nick Hodge" wrote in message
...
Mark

I'm struggling to understand what you mean by 'close' the last worksheet
and 'save to web for this database', but to iterate through all your
worksheets, hiding column 'J' and then *hide* the last sheet, you could
do something like

Sub HideJAndLastSheet()
Dim x As Integer, y As Integer
Dim wks As Worksheet
x = ThisWorkbook.Worksheets.Count
y = 1
For Each wks In ThisWorkbook.Worksheets
wks.Columns("J").Hidden = True
If y = x Then wks.Visible = xlSheetHidden
y = y + 1
Next wks
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
web:
www.nickhodge.co.uk
web: www.excelusergroup.org




"Mark G." wrote in message
...
I am trying to set a simple macro that will hide 1 certain column ('J',
in this case) on each worksheet with my workbook. At the same time, I
would like it to close a particular worksheet (the last one in the
string of them all - about 14 worksheets within workbook). Need these
set to 'save to web' for this database I have going. I have tried this a
few methods to include keeping it relative, but no luck. I can do them
individually for each worksheet, but can not for the lump some of them
with one simple macro. Got to be something simple I am missing. Checked
through my books with no luck. So if you could, would be nice to fill me
in with what I am doing wrong and how do this effectively. Thanks much.







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Issue with marco for entire workbook

Will try one more time to see if anyone here can assist???? Anyone??



"Mark G." wrote in message
...
Can anyone offer any help here?


"Mark G." wrote in message
...
What I got now seems to work fine and here it is:

Sub HideJAndLastSheet()
Dim x As Integer, y As Integer
Dim wks As Worksheet
x = ThisWorkbook.Worksheets.Count
y = 1
For Each wks In ThisWorkbook.Worksheets
wks.Columns("J").Hidden = True
If y = x Then wks.Visible = xlSheetHidden
y = y + 1
Next wks
ActiveWorkbook.Save
Range("C16").Select
Application.MacroOptions Macro:="HideJAndLastSheet", Description:= _
"Hide Column J in all and last worksheet.", ShortcutKey:="H"
Application.Run "'HW-Collection.xls'!HideJAndLastSheet"
Application.Run "'HW-Collection.xls'!HideJAndLastSheet"
Range("C10").Select
Application.Run "'HW-Collection.xls'!HideJAndLastSheet"
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("Unimogs").Select
Range("D22").Select
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("Ferrari").Select
Range("E25").Select
Application.Run "'HW-Collection.xls'!HideJAndLastSheet"
Range("E24").Select
End Sub

But, now how do I set this up so that it will unhide those columns and
restore the last worksheet?

Thanks much.


"Nick Hodge" wrote in message
...
Mark

I'm struggling to understand what you mean by 'close' the last worksheet
and 'save to web for this database', but to iterate through all your
worksheets, hiding column 'J' and then *hide* the last sheet, you could
do something like

Sub HideJAndLastSheet()
Dim x As Integer, y As Integer
Dim wks As Worksheet
x = ThisWorkbook.Worksheets.Count
y = 1
For Each wks In ThisWorkbook.Worksheets
wks.Columns("J").Hidden = True
If y = x Then wks.Visible = xlSheetHidden
y = y + 1
Next wks
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
web:
www.nickhodge.co.uk
web: www.excelusergroup.org




"Mark G." wrote in message
...
I am trying to set a simple macro that will hide 1 certain column ('J',
in this case) on each worksheet with my workbook. At the same time, I
would like it to close a particular worksheet (the last one in the
string of them all - about 14 worksheets within workbook). Need these
set to 'save to web' for this database I have going. I have tried this
a few methods to include keeping it relative, but no luck. I can do
them individually for each worksheet, but can not for the lump some of
them with one simple macro. Got to be something simple I am missing.
Checked through my books with no luck. So if you could, would be nice
to fill me in with what I am doing wrong and how do this effectively.
Thanks much.







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Issue with marco for entire workbook

Was Nick's macro not suitable or on the right track?

If not, why not?

You could post answers to Nick's questions to provide more detail of your needs.


Gord Dibben MS Excel MVP

On Fri, 25 Jan 2008 00:42:13 -0800, "Mark G." wrote:

Will try one more time to see if anyone here can assist???? Anyone??



"Mark G." wrote in message
...
Can anyone offer any help here?


"Mark G." wrote in message
...
What I got now seems to work fine and here it is:

Sub HideJAndLastSheet()
Dim x As Integer, y As Integer
Dim wks As Worksheet
x = ThisWorkbook.Worksheets.Count
y = 1
For Each wks In ThisWorkbook.Worksheets
wks.Columns("J").Hidden = True
If y = x Then wks.Visible = xlSheetHidden
y = y + 1
Next wks
ActiveWorkbook.Save
Range("C16").Select
Application.MacroOptions Macro:="HideJAndLastSheet", Description:= _
"Hide Column J in all and last worksheet.", ShortcutKey:="H"
Application.Run "'HW-Collection.xls'!HideJAndLastSheet"
Application.Run "'HW-Collection.xls'!HideJAndLastSheet"
Range("C10").Select
Application.Run "'HW-Collection.xls'!HideJAndLastSheet"
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("Unimogs").Select
Range("D22").Select
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("Ferrari").Select
Range("E25").Select
Application.Run "'HW-Collection.xls'!HideJAndLastSheet"
Range("E24").Select
End Sub

But, now how do I set this up so that it will unhide those columns and
restore the last worksheet?

Thanks much.


"Nick Hodge" wrote in message
...
Mark

I'm struggling to understand what you mean by 'close' the last worksheet
and 'save to web for this database', but to iterate through all your
worksheets, hiding column 'J' and then *hide* the last sheet, you could
do something like

Sub HideJAndLastSheet()
Dim x As Integer, y As Integer
Dim wks As Worksheet
x = ThisWorkbook.Worksheets.Count
y = 1
For Each wks In ThisWorkbook.Worksheets
wks.Columns("J").Hidden = True
If y = x Then wks.Visible = xlSheetHidden
y = y + 1
Next wks
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
web:
www.nickhodge.co.uk
web: www.excelusergroup.org




"Mark G." wrote in message
...
I am trying to set a simple macro that will hide 1 certain column ('J',
in this case) on each worksheet with my workbook. At the same time, I
would like it to close a particular worksheet (the last one in the
string of them all - about 14 worksheets within workbook). Need these
set to 'save to web' for this database I have going. I have tried this
a few methods to include keeping it relative, but no luck. I can do
them individually for each worksheet, but can not for the lump some of
them with one simple macro. Got to be something simple I am missing.
Checked through my books with no luck. So if you could, would be nice
to fill me in with what I am doing wrong and how do this effectively.
Thanks much.







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
Name an Entire Workbook NaBellFL Excel Discussion (Misc queries) 3 November 15th 07 03:49 PM
Marco issue KA Excel Discussion (Misc queries) 3 October 19th 07 07:50 PM
Personal marco workbook CT NG Excel Programming 2 June 28th 07 03:36 AM
How to Copy entire Worksheet from Workbook S to Workbook D kris Excel Programming 3 June 20th 07 02:03 PM
Marco print issue!!! richardderrick Excel Programming 1 May 30th 06 12:58 PM


All times are GMT +1. The time now is 10:38 PM.

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

About Us

"It's about Microsoft Excel"