+ Reply to Thread
Results 1 to 7 of 7

How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook?

Hybrid View

Guest How to repeat a code for... 03-29-2006, 06:20 AM
Guest RE: How to repeat a code for... 03-29-2006, 06:30 AM
Guest Re: How to repeat a code for... 03-29-2006, 06:45 AM
Guest Re: How to repeat a code for... 03-29-2006, 07:30 AM
Guest Re: How to repeat a code for... 03-29-2006, 07:50 AM
Guest Re: How to repeat a code for... 03-29-2006, 07:25 AM
Guest Re: How to repeat a code for... 03-29-2006, 07:50 AM
  1. #1
    Dmitry
    Guest

    How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook?

    Hello
    How to repeat a code for selected sheets (or a contiguous range of sheets)
    in a Workbook?
    The code is:
    Range("J16").Select
    SolverOk SetCell:="$J$16", MaxMinVal:=1, ValueOf:="0",
    ByChange:="$F$4:$I$12"
    SolverSolve UserFinish:=True



  2. #2
    Viquar
    Guest

    RE: How to repeat a code for selected sheets (or a contiguous range of

    For each ws in ActiveWorkbook.Sheets
    ws.Range("J16").Select
    SolverOk SetCell:="$J$16", MaxMinVal:=1, ValueOf:="0",
    ByChange:="$F$4:$I$12"
    SolverSolve UserFinish:=True

    Next

    "Dmitry" wrote:

    > Hello
    > How to repeat a code for selected sheets (or a contiguous range of sheets)
    > in a Workbook?
    > The code is:
    > Range("J16").Select
    > SolverOk SetCell:="$J$16", MaxMinVal:=1, ValueOf:="0",
    > ByChange:="$F$4:$I$12"
    > SolverSolve UserFinish:=True
    >
    >
    >


  3. #3
    Dmitry
    Guest

    Re: How to repeat a code for selected sheets (or a contiguous range of

    Thanks Viquar for replying.
    Does "For each ws in ActiveWorkbook.Sheets" repeats for all worksheets? I
    wrote "How to repeat a code for selected sheets (or a contiguous range of
    sheets) in a Workbook?", not all worksheets.
    "Viquar" <Viquar@discussions.microsoft.com> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ
    ÓÌÅÄÕÀÝÅÅ: news:2FDA40AD-050E-4547-8B5D-D12CC54BDA48@microsoft.com...
    > For each ws in ActiveWorkbook.Sheets
    > ws.Range("J16").Select
    > SolverOk SetCell:="$J$16", MaxMinVal:=1, ValueOf:="0",
    > ByChange:="$F$4:$I$12"
    > SolverSolve UserFinish:=True
    >
    > Next
    >
    > "Dmitry" wrote:
    >
    > > Hello
    > > How to repeat a code for selected sheets (or a contiguous range of

    sheets)
    > > in a Workbook?
    > > The code is:
    > > Range("J16").Select
    > > SolverOk SetCell:="$J$16", MaxMinVal:=1, ValueOf:="0",
    > > ByChange:="$F$4:$I$12"
    > > SolverSolve UserFinish:=True
    > >
    > >
    > >




  4. #4
    Dave Peterson
    Guest

    Re: How to repeat a code for selected sheets (or a contiguous range of

    Maybe...

    For each ws in ActiveWindow.selectedSheets

    Dmitry wrote:
    >
    > Thanks Viquar for replying.
    > Does "For each ws in ActiveWorkbook.Sheets" repeats for all worksheets? I
    > wrote "How to repeat a code for selected sheets (or a contiguous range of
    > sheets) in a Workbook?", not all worksheets.
    > "Viquar" <Viquar@discussions.microsoft.com> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ
    > ÓÌÅÄÕÀÝÅÅ: news:2FDA40AD-050E-4547-8B5D-D12CC54BDA48@microsoft.com...
    > > For each ws in ActiveWorkbook.Sheets
    > > ws.Range("J16").Select
    > > SolverOk SetCell:="$J$16", MaxMinVal:=1, ValueOf:="0",
    > > ByChange:="$F$4:$I$12"
    > > SolverSolve UserFinish:=True
    > >
    > > Next
    > >
    > > "Dmitry" wrote:
    > >
    > > > Hello
    > > > How to repeat a code for selected sheets (or a contiguous range of

    > sheets)
    > > > in a Workbook?
    > > > The code is:
    > > > Range("J16").Select
    > > > SolverOk SetCell:="$J$16", MaxMinVal:=1, ValueOf:="0",
    > > > ByChange:="$F$4:$I$12"
    > > > SolverSolve UserFinish:=True
    > > >
    > > >
    > > >


    --

    Dave Peterson

  5. #5
    Dmitry
    Guest

    Re: How to repeat a code for selected sheets (or a contiguous range of

    Thanks. I will try.
    "Dave Peterson" <petersod@verizonXSPAM.net> ???????/???????? ? ????????
    ?????????: news:442A6E59.E12244DD@verizonXSPAM.net...
    > Maybe...
    >
    > For each ws in ActiveWindow.selectedSheets
    >
    > Dmitry wrote:
    > >
    > > Thanks Viquar for replying.
    > > Does "For each ws in ActiveWorkbook.Sheets" repeats for all worksheets?

    I
    > > wrote "How to repeat a code for selected sheets (or a contiguous range

    of
    > > sheets) in a Workbook?", not all worksheets.
    > > "Viquar" <Viquar@discussions.microsoft.com> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ
    > > ÓÌÅÄÕÀÝÅÅ: news:2FDA40AD-050E-4547-8B5D-D12CC54BDA48@microsoft.com...
    > > > For each ws in ActiveWorkbook.Sheets
    > > > ws.Range("J16").Select
    > > > SolverOk SetCell:="$J$16", MaxMinVal:=1, ValueOf:="0",
    > > > ByChange:="$F$4:$I$12"
    > > > SolverSolve UserFinish:=True
    > > >
    > > > Next
    > > >
    > > > "Dmitry" wrote:
    > > >
    > > > > Hello
    > > > > How to repeat a code for selected sheets (or a contiguous range of

    > > sheets)
    > > > > in a Workbook?
    > > > > The code is:
    > > > > Range("J16").Select
    > > > > SolverOk SetCell:="$J$16", MaxMinVal:=1, ValueOf:="0",
    > > > > ByChange:="$F$4:$I$12"
    > > > > SolverSolve UserFinish:=True
    > > > >
    > > > >
    > > > >

    >
    > --
    >
    > Dave Peterson




  6. #6
    Norman Jones
    Guest

    Re: How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook?

    Hi Dmitry,

    Try something like:

    '=============>>
    Public Sub Tester()
    Dim SH As Worksheet
    For Each SH In ActiveWindow.SelectedSheets
    With SH
    Application.Goto .Range("J16")
    'Your Solver code
    End With
    Next SH
    End Sub
    '<<=============


    ---
    Regards,
    Norman



    "Dmitry" <kopn@bk.ruDelete> wrote in message
    news:%23U0zFlxUGHA.4976@TK2MSFTNGP11.phx.gbl...
    > Hello
    > How to repeat a code for selected sheets (or a contiguous range of sheets)
    > in a Workbook?
    > The code is:
    > Range("J16").Select
    > SolverOk SetCell:="$J$16", MaxMinVal:=1, ValueOf:="0",
    > ByChange:="$F$4:$I$12"
    > SolverSolve UserFinish:=True
    >
    >




  7. #7
    Dmitry
    Guest

    Re: How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook?

    Thanks. I will try.
    "Norman Jones" <normanjones@whereforartthou.com> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ
    ÓÌÅÄÕÀÝÅÅ: news:ePy9cMyUGHA.1572@tk2msftngp13.phx.gbl...
    > Hi Dmitry,
    >
    > Try something like:
    >
    > '=============>>
    > Public Sub Tester()
    > Dim SH As Worksheet
    > For Each SH In ActiveWindow.SelectedSheets
    > With SH
    > Application.Goto .Range("J16")
    > 'Your Solver code
    > End With
    > Next SH
    > End Sub
    > '<<=============
    >
    >
    > ---
    > Regards,
    > Norman
    >
    >
    >
    > "Dmitry" <kopn@bk.ruDelete> wrote in message
    > news:%23U0zFlxUGHA.4976@TK2MSFTNGP11.phx.gbl...
    > > Hello
    > > How to repeat a code for selected sheets (or a contiguous range of

    sheets)
    > > in a Workbook?
    > > The code is:
    > > Range("J16").Select
    > > SolverOk SetCell:="$J$16", MaxMinVal:=1, ValueOf:="0",
    > > ByChange:="$F$4:$I$12"
    > > SolverSolve UserFinish:=True
    > >
    > >

    >
    >




+ 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