Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
Dmitry
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions,microsoft.public.excel
Viquar
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions,microsoft.public.excel
Dmitry
 
Posts: n/a
Default 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





  #4   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
Norman Jones
 
Posts: n/a
Default 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




  #5   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions,microsoft.public.excel
Dave Peterson
 
Posts: n/a
Default 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


  #6   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions,microsoft.public.excel
Dmitry
 
Posts: n/a
Default 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



  #7   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
Dmitry
 
Posts: n/a
Default 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






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
Common range name for 2 sheets David Excel Discussion (Misc queries) 6 January 24th 06 03:26 PM
Macros for Protect/Unprotect all sheets in a workbook Paul Sheppard Excel Discussion (Misc queries) 2 August 4th 05 04:30 PM
Dynamic named range across multiple sheets babycody Excel Discussion (Misc queries) 3 July 24th 05 06:03 AM
Copying multiple sheets from one book 2 another and undertake spec Pank Mehta Excel Discussion (Misc queries) 14 March 16th 05 04:41 PM
Stubborn toolbars in Excel 007 Excel Discussion (Misc queries) 9 December 11th 04 02:02 PM


All times are GMT +1. The time now is 08:59 PM.

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

About Us

"It's about Microsoft Excel"