PC Review


Reply
Thread Tools Rate Thread

Custom View Macro for Excel 2007

 
 
Winnipeg Michael
Guest
Posts: n/a
 
      23rd Sep 2008
I have a custom view, that I would like to turn into a macro, so I can click
a button, instead of having to click the Custom View button and subsequent
clicks.

Does anyone have one already made, or can share what I need to do to write
the macro?

Thank you
 
Reply With Quote
 
 
 
 
Excel.Instructor
Guest
Posts: n/a
 
      23rd Sep 2008
On Sep 23, 1:13*pm, Winnipeg Michael
<WinnipegMich...@discussions.microsoft.com> wrote:
> I have a custom view, that I would like to turn into a macro, so I can click
> a button, instead of having to click the Custom View button and subsequent
> clicks.
>
> Does anyone have one already made, or can share what I need to do to write
> the macro?
>
> Thank you


Winnipeg Michael:
Attached is the code you can use. Replace the "MyView" with the name
of your custom view.

ActiveWorkbook.CustomViews("MyView").Show

Best of luck.

Excel.Instructor (Ed2go.com/Advanced Excel)
 
Reply With Quote
 
Winnipeg Michael
Guest
Posts: n/a
 
      23rd Sep 2008
Hey Excel.Instructor.

Thanks for your post.

It almost works.
I can run the macro in my Personal.xlsx sheet. When I try to use the macro
in another spreadsheet (with Personal.xlsx open), I get the "Run-time error
'5': Invalid procedure call or argument" error. Rats.

Because I actually want to use this macro on other spreadsheets, and not the
Personal.xlsx, does it mean that I cant use it? Or is it a simple error that
can be fixed?

Thanks

Michael



"Excel.Instructor" wrote:

> On Sep 23, 1:13 pm, Winnipeg Michael
> <WinnipegMich...@discussions.microsoft.com> wrote:
> > I have a custom view, that I would like to turn into a macro, so I can click
> > a button, instead of having to click the Custom View button and subsequent
> > clicks.
> >
> > Does anyone have one already made, or can share what I need to do to write
> > the macro?
> >
> > Thank you

>
> Winnipeg Michael:
> Attached is the code you can use. Replace the "MyView" with the name
> of your custom view.
>
> ActiveWorkbook.CustomViews("MyView").Show
>
> Best of luck.
>
> Excel.Instructor (Ed2go.com/Advanced Excel)
>

 
Reply With Quote
 
RyanH
Guest
Posts: n/a
 
      24th Sep 2008
You are getting the error because the macro is looking for the CustomView in
your new spreadsheet and it isn't there. The CustomView is saved in the
workbook it was created in.

My suggestion would be use the macro recorder to recorder how you manipulate
the worksheet view such as hidding rows, zooming, etc. and use that recording
as your custom view. For example, put the code below in a Personal Workbook
Module.

Sub CustomView()

ActiveWindow.Zoom = 75
With ActiveSheet
.Cells.EntireRow.Hidden = False
.Rows("1:5").EntireRow.Hidden = True
End With

End Sub

Hope this helps! If so, click "Yes" below.

--
Cheers,
Ryan


"Winnipeg Michael" wrote:

> Hey Excel.Instructor.
>
> Thanks for your post.
>
> It almost works.
> I can run the macro in my Personal.xlsx sheet. When I try to use the macro
> in another spreadsheet (with Personal.xlsx open), I get the "Run-time error
> '5': Invalid procedure call or argument" error. Rats.
>
> Because I actually want to use this macro on other spreadsheets, and not the
> Personal.xlsx, does it mean that I cant use it? Or is it a simple error that
> can be fixed?
>
> Thanks
>
> Michael
>
>
>
> "Excel.Instructor" wrote:
>
> > On Sep 23, 1:13 pm, Winnipeg Michael
> > <WinnipegMich...@discussions.microsoft.com> wrote:
> > > I have a custom view, that I would like to turn into a macro, so I can click
> > > a button, instead of having to click the Custom View button and subsequent
> > > clicks.
> > >
> > > Does anyone have one already made, or can share what I need to do to write
> > > the macro?
> > >
> > > Thank you

> >
> > Winnipeg Michael:
> > Attached is the code you can use. Replace the "MyView" with the name
> > of your custom view.
> >
> > ActiveWorkbook.CustomViews("MyView").Show
> >
> > Best of luck.
> >
> > Excel.Instructor (Ed2go.com/Advanced Excel)
> >

 
Reply With Quote
 
Winnipeg Michael
Guest
Posts: n/a
 
      24th Sep 2008
Thanks RyanH for your reply.

I will try that and let you know.

Michael




"RyanH" wrote:

> You are getting the error because the macro is looking for the CustomView in
> your new spreadsheet and it isn't there. The CustomView is saved in the
> workbook it was created in.
>
> My suggestion would be use the macro recorder to recorder how you manipulate
> the worksheet view such as hidding rows, zooming, etc. and use that recording
> as your custom view. For example, put the code below in a Personal Workbook
> Module.
>
> Sub CustomView()
>
> ActiveWindow.Zoom = 75
> With ActiveSheet
> .Cells.EntireRow.Hidden = False
> .Rows("1:5").EntireRow.Hidden = True
> End With
>
> End Sub
>
> Hope this helps! If so, click "Yes" below.
>
> --
> Cheers,
> Ryan
>
>
> "Winnipeg Michael" wrote:
>
> > Hey Excel.Instructor.
> >
> > Thanks for your post.
> >
> > It almost works.
> > I can run the macro in my Personal.xlsx sheet. When I try to use the macro
> > in another spreadsheet (with Personal.xlsx open), I get the "Run-time error
> > '5': Invalid procedure call or argument" error. Rats.
> >
> > Because I actually want to use this macro on other spreadsheets, and not the
> > Personal.xlsx, does it mean that I cant use it? Or is it a simple error that
> > can be fixed?
> >
> > Thanks
> >
> > Michael
> >
> >
> >
> > "Excel.Instructor" wrote:
> >
> > > On Sep 23, 1:13 pm, Winnipeg Michael
> > > <WinnipegMich...@discussions.microsoft.com> wrote:
> > > > I have a custom view, that I would like to turn into a macro, so I can click
> > > > a button, instead of having to click the Custom View button and subsequent
> > > > clicks.
> > > >
> > > > Does anyone have one already made, or can share what I need to do to write
> > > > the macro?
> > > >
> > > > Thank you
> > >
> > > Winnipeg Michael:
> > > Attached is the code you can use. Replace the "MyView" with the name
> > > of your custom view.
> > >
> > > ActiveWorkbook.CustomViews("MyView").Show
> > >
> > > Best of luck.
> > >
> > > Excel.Instructor (Ed2go.com/Advanced Excel)
> > >

 
Reply With Quote
 
Winnipeg Michael
Guest
Posts: n/a
 
      24th Sep 2008
Hi RyanH.

Took your example, tweaked it to what I was looking for:

Sub Macro5()
'
' Macro5 Macro
'

'
With ActiveSheet
.Columns("H:I").EntireColumn.Hidden = True
.Columns("U:AE").EntireColumn.Hidden = True
End With
End Sub

.........and it works like a charm.

Thanks so much.
If I need more help with macros, can I contact you?

Thanks again,
Michael




"Winnipeg Michael" wrote:

> Thanks RyanH for your reply.
>
> I will try that and let you know.
>
> Michael
>
>
>
>
> "RyanH" wrote:
>
> > You are getting the error because the macro is looking for the CustomView in
> > your new spreadsheet and it isn't there. The CustomView is saved in the
> > workbook it was created in.
> >
> > My suggestion would be use the macro recorder to recorder how you manipulate
> > the worksheet view such as hidding rows, zooming, etc. and use that recording
> > as your custom view. For example, put the code below in a Personal Workbook
> > Module.
> >
> > Sub CustomView()
> >
> > ActiveWindow.Zoom = 75
> > With ActiveSheet
> > .Cells.EntireRow.Hidden = False
> > .Rows("1:5").EntireRow.Hidden = True
> > End With
> >
> > End Sub
> >
> > Hope this helps! If so, click "Yes" below.
> >
> > --
> > Cheers,
> > Ryan
> >
> >
> > "Winnipeg Michael" wrote:
> >
> > > Hey Excel.Instructor.
> > >
> > > Thanks for your post.
> > >
> > > It almost works.
> > > I can run the macro in my Personal.xlsx sheet. When I try to use the macro
> > > in another spreadsheet (with Personal.xlsx open), I get the "Run-time error
> > > '5': Invalid procedure call or argument" error. Rats.
> > >
> > > Because I actually want to use this macro on other spreadsheets, and not the
> > > Personal.xlsx, does it mean that I cant use it? Or is it a simple error that
> > > can be fixed?
> > >
> > > Thanks
> > >
> > > Michael
> > >
> > >
> > >
> > > "Excel.Instructor" wrote:
> > >
> > > > On Sep 23, 1:13 pm, Winnipeg Michael
> > > > <WinnipegMich...@discussions.microsoft.com> wrote:
> > > > > I have a custom view, that I would like to turn into a macro, so I can click
> > > > > a button, instead of having to click the Custom View button and subsequent
> > > > > clicks.
> > > > >
> > > > > Does anyone have one already made, or can share what I need to do to write
> > > > > the macro?
> > > > >
> > > > > Thank you
> > > >
> > > > Winnipeg Michael:
> > > > Attached is the code you can use. Replace the "MyView" with the name
> > > > of your custom view.
> > > >
> > > > ActiveWorkbook.CustomViews("MyView").Show
> > > >
> > > > Best of luck.
> > > >
> > > > Excel.Instructor (Ed2go.com/Advanced Excel)
> > > >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 Run Remote/Server/Network/Shared Macro From Custom Butt SQL Servant Microsoft Excel Discussion 0 11th Dec 2009 04:06 PM
Excel 2007 Custom View Inactive? Lori H. Microsoft Excel Misc 4 17th Jun 2009 06:14 PM
Excel 2007, Add custom menu with macro Doekoe Microsoft Excel Discussion 1 9th Jun 2009 07:08 PM
2003 - 2007 custom macro and custom button restore. Scott Sornberger Microsoft Excel Misc 11 23rd May 2008 02:41 PM
View Custom Toolbar in Excel 2007 Thomas M. Microsoft Excel Discussion 7 11th Oct 2007 06:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:04 AM.