![]() |
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 |
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 |
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" сообщил/сообщила в новостях следующее: ... 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 |
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" wrote in message ... 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 |
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" сообщил/сообщила в новостях следующее: ... 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 |
How to repeat a code for selected sheets (or a contiguous range of
Thanks. I will try.
"Dave Peterson" ???????/???????? ? ???????? ?????????: ... 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" сообщил/сообщила в новостях следующее: ... 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 |
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook?
Thanks. I will try.
"Norman Jones" сообщил/сообщила в новостях следующее: ... 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" wrote in message ... 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 |
All times are GMT +1. The time now is 04:35 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com