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
external usenet poster
 
Posts: 32
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
external usenet poster
 
Posts: 1
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
external usenet poster
 
Posts: 32
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.programming,microsoft.public.excel.worksheet.functions,microsoft.public.excel
external usenet poster
 
Posts: 35,218
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
  #5   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions,microsoft.public.excel
external usenet poster
 
Posts: 32
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





  #6   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,302
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




  #7   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 32
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
All sheets in workbook have same rows to repeat at top Subodh Excel Worksheet Functions 1 June 26th 11 04:53 PM
vb code to copy and list selected row to diff sheets pvkutty Excel Discussion (Misc queries) 1 February 17th 10 12:05 PM
Sum of selected cells from different sheets in a new workbook Vijay Joshi Excel Worksheet Functions 3 January 9th 07 02:51 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Worksheet Functions 6 March 29th 06 12:43 PM
VBA Code To have a macro repeat on all sheets in a workbook carl Excel Worksheet Functions 3 November 3rd 05 07:48 PM


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

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

About Us

"It's about Microsoft Excel"