+ Reply to Thread
Results 1 to 18 of 18

Make Macro go to Next Workseet

Hybrid View

  1. #1
    Chip Pearson
    Guest

    Re: Make Macro go to Next Workseet

    No, you don't need to declare Ndx as a global variable. Just
    declare it within the procedure.


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com


    "Michael from Austin"
    <MichaelfromAustin@discussions.microsoft.com> wrote in message
    news:277BAE26-B39A-4DA2-A190-6C21EA9F8077@microsoft.com...
    > It is all on one line. It errors, the same error as before,
    > still. Do I need
    > to declare Ndx as a global variable?
    >
    > "Chip Pearson" wrote:
    >
    >> I should have added that
    >>
    >> For Ndx = ActiveSheet.Index + 1 To
    >> Worksheets(Worksheets.Count).Index
    >>
    >> should all be on a single line of code.
    >>
    >>
    >> --
    >> Cordially,
    >> Chip Pearson
    >> Microsoft MVP - Excel
    >> Pearson Software Consulting, LLC
    >> www.cpearson.com
    >>
    >>
    >>
    >>
    >> "Michael from Austin"
    >> <MichaelfromAustin@discussions.microsoft.com> wrote in message
    >> news:C54039C4-BE58-433D-B4CA-1A4912595567@microsoft.com...
    >> >I received a Run Time Error 424. "Object Required."
    >> >
    >> > "Chip Pearson" wrote:
    >> >
    >> >> Michael,
    >> >>
    >> >> Try something like the following:
    >> >>
    >> >> Dim Ndx As Integer
    >> >> For Ndx = ActiveSheet.Index + 1 To
    >> >> Worksheets(Worksheets.Count).Index
    >> >> Worksheets(Ndx).Range("A1").Value = 123
    >> >> Next Ndx
    >> >>
    >> >>
    >> >>
    >> >> --
    >> >> Cordially,
    >> >> Chip Pearson
    >> >> Microsoft MVP - Excel
    >> >> Pearson Software Consulting, LLC
    >> >> www.cpearson.com
    >> >>
    >> >>
    >> >>
    >> >>
    >> >> "Michael from Austin"
    >> >> <MichaelfromAustin@discussions.microsoft.com> wrote in
    >> >> message
    >> >> news:C1412190-BA8A-4B54-8E55-FB4E0A0CD1F9@microsoft.com...
    >> >> >I have a macro that I want to have also run on the next
    >> >> >worksheet and then
    >> >> > the next until there are no more worksheet. The
    >> >> > worksheets
    >> >> > have
    >> >> > names. I do
    >> >> > not want it to have to look for the name and then open
    >> >> > it. I
    >> >> > just want it to
    >> >> > go to the next one and then the next until the end...
    >> >> > Can
    >> >> > this
    >> >> > be done. Any
    >> >> > help would be appreceited.....
    >> >> > --
    >> >> > Regards,
    >> >> > Michael
    >> >>
    >> >>
    >> >>

    >>
    >>
    >>




  2. #2
    Michael from Austin
    Guest

    Re: Make Macro go to Next Workseet

    I'm still getting the same error...

    "Chip Pearson" wrote:

    > No, you don't need to declare Ndx as a global variable. Just
    > declare it within the procedure.
    >
    >
    > --
    > Cordially,
    > Chip Pearson
    > Microsoft MVP - Excel
    > Pearson Software Consulting, LLC
    > www.cpearson.com
    >
    >
    > "Michael from Austin"
    > <MichaelfromAustin@discussions.microsoft.com> wrote in message
    > news:277BAE26-B39A-4DA2-A190-6C21EA9F8077@microsoft.com...
    > > It is all on one line. It errors, the same error as before,
    > > still. Do I need
    > > to declare Ndx as a global variable?
    > >
    > > "Chip Pearson" wrote:
    > >
    > >> I should have added that
    > >>
    > >> For Ndx = ActiveSheet.Index + 1 To
    > >> Worksheets(Worksheets.Count).Index
    > >>
    > >> should all be on a single line of code.
    > >>
    > >>
    > >> --
    > >> Cordially,
    > >> Chip Pearson
    > >> Microsoft MVP - Excel
    > >> Pearson Software Consulting, LLC
    > >> www.cpearson.com
    > >>
    > >>
    > >>
    > >>
    > >> "Michael from Austin"
    > >> <MichaelfromAustin@discussions.microsoft.com> wrote in message
    > >> news:C54039C4-BE58-433D-B4CA-1A4912595567@microsoft.com...
    > >> >I received a Run Time Error 424. "Object Required."
    > >> >
    > >> > "Chip Pearson" wrote:
    > >> >
    > >> >> Michael,
    > >> >>
    > >> >> Try something like the following:
    > >> >>
    > >> >> Dim Ndx As Integer
    > >> >> For Ndx = ActiveSheet.Index + 1 To
    > >> >> Worksheets(Worksheets.Count).Index
    > >> >> Worksheets(Ndx).Range("A1").Value = 123
    > >> >> Next Ndx
    > >> >>
    > >> >>
    > >> >>
    > >> >> --
    > >> >> Cordially,
    > >> >> Chip Pearson
    > >> >> Microsoft MVP - Excel
    > >> >> Pearson Software Consulting, LLC
    > >> >> www.cpearson.com
    > >> >>
    > >> >>
    > >> >>
    > >> >>
    > >> >> "Michael from Austin"
    > >> >> <MichaelfromAustin@discussions.microsoft.com> wrote in
    > >> >> message
    > >> >> news:C1412190-BA8A-4B54-8E55-FB4E0A0CD1F9@microsoft.com...
    > >> >> >I have a macro that I want to have also run on the next
    > >> >> >worksheet and then
    > >> >> > the next until there are no more worksheet. The
    > >> >> > worksheets
    > >> >> > have
    > >> >> > names. I do
    > >> >> > not want it to have to look for the name and then open
    > >> >> > it. I
    > >> >> > just want it to
    > >> >> > go to the next one and then the next until the end...
    > >> >> > Can
    > >> >> > this
    > >> >> > be done. Any
    > >> >> > help would be appreceited.....
    > >> >> > --
    > >> >> > Regards,
    > >> >> > Michael
    > >> >>
    > >> >>
    > >> >>
    > >>
    > >>
    > >>

    >
    >
    >


  3. #3
    Dave Peterson
    Guest

    Re: Make Macro go to Next Workseet

    I think it's time for you to paste the procedure that you're trying.

    Michael from Austin wrote:
    >
    > I'm still getting the same error...
    >
    > "Chip Pearson" wrote:
    >
    > > No, you don't need to declare Ndx as a global variable. Just
    > > declare it within the procedure.
    > >
    > >
    > > --
    > > Cordially,
    > > Chip Pearson
    > > Microsoft MVP - Excel
    > > Pearson Software Consulting, LLC
    > > www.cpearson.com
    > >
    > >
    > > "Michael from Austin"
    > > <MichaelfromAustin@discussions.microsoft.com> wrote in message
    > > news:277BAE26-B39A-4DA2-A190-6C21EA9F8077@microsoft.com...
    > > > It is all on one line. It errors, the same error as before,
    > > > still. Do I need
    > > > to declare Ndx as a global variable?
    > > >
    > > > "Chip Pearson" wrote:
    > > >
    > > >> I should have added that
    > > >>
    > > >> For Ndx = ActiveSheet.Index + 1 To
    > > >> Worksheets(Worksheets.Count).Index
    > > >>
    > > >> should all be on a single line of code.
    > > >>
    > > >>
    > > >> --
    > > >> Cordially,
    > > >> Chip Pearson
    > > >> Microsoft MVP - Excel
    > > >> Pearson Software Consulting, LLC
    > > >> www.cpearson.com
    > > >>
    > > >>
    > > >>
    > > >>
    > > >> "Michael from Austin"
    > > >> <MichaelfromAustin@discussions.microsoft.com> wrote in message
    > > >> news:C54039C4-BE58-433D-B4CA-1A4912595567@microsoft.com...
    > > >> >I received a Run Time Error 424. "Object Required."
    > > >> >
    > > >> > "Chip Pearson" wrote:
    > > >> >
    > > >> >> Michael,
    > > >> >>
    > > >> >> Try something like the following:
    > > >> >>
    > > >> >> Dim Ndx As Integer
    > > >> >> For Ndx = ActiveSheet.Index + 1 To
    > > >> >> Worksheets(Worksheets.Count).Index
    > > >> >> Worksheets(Ndx).Range("A1").Value = 123
    > > >> >> Next Ndx
    > > >> >>
    > > >> >>
    > > >> >>
    > > >> >> --
    > > >> >> Cordially,
    > > >> >> Chip Pearson
    > > >> >> Microsoft MVP - Excel
    > > >> >> Pearson Software Consulting, LLC
    > > >> >> www.cpearson.com
    > > >> >>
    > > >> >>
    > > >> >>
    > > >> >>
    > > >> >> "Michael from Austin"
    > > >> >> <MichaelfromAustin@discussions.microsoft.com> wrote in
    > > >> >> message
    > > >> >> news:C1412190-BA8A-4B54-8E55-FB4E0A0CD1F9@microsoft.com...
    > > >> >> >I have a macro that I want to have also run on the next
    > > >> >> >worksheet and then
    > > >> >> > the next until there are no more worksheet. The
    > > >> >> > worksheets
    > > >> >> > have
    > > >> >> > names. I do
    > > >> >> > not want it to have to look for the name and then open
    > > >> >> > it. I
    > > >> >> > just want it to
    > > >> >> > go to the next one and then the next until the end...
    > > >> >> > Can
    > > >> >> > this
    > > >> >> > be done. Any
    > > >> >> > help would be appreceited.....
    > > >> >> > --
    > > >> >> > Regards,
    > > >> >> > Michael
    > > >> >>
    > > >> >>
    > > >> >>
    > > >>
    > > >>
    > > >>

    > >
    > >
    > >


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1