nechehov
Дата: Суббота, 03.06.2017, 17:20 |
Сообщение № 1
Группа: Пользователи
Ранг: Участник
Сообщений: 81
Репутация:
0
±
Замечаний:
0% ±
Excel 2016
Добрый день! Записал макрос для замены строк в ограничениях Поиска решения. Как сделать так, чтобы это же действие повторялось до 52 строки? [vba]Код
Sub Макрос1() ' ' Макрос1 Макрос ' ' SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AA$25", Relation:=2, FormulaText:="0" SolverAdd CellRef:="$AA$26", Relation:=2, FormulaText:="0" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AI$25", Relation:=2, FormulaText:="$AI$7" SolverAdd CellRef:="$AI$26", Relation:=2, FormulaText:="$AI$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AJ$25", Relation:=2, FormulaText:="$AJ$7" SolverAdd CellRef:="$AJ$26", Relation:=2, FormulaText:="$AJ$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AK$25", Relation:=2, FormulaText:="$AK$7" SolverAdd CellRef:="$AK$26", Relation:=2, FormulaText:="$AK$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AL$25", Relation:=2, FormulaText:="$AL$7" SolverAdd CellRef:="$AL$26", Relation:=2, FormulaText:="$AL$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AM$25", Relation:=2, FormulaText:="$AM$7" SolverAdd CellRef:="$AM$26", Relation:=2, FormulaText:="$AM$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AN$25", Relation:=2, FormulaText:="$AN$7" SolverAdd CellRef:="$AN$26", Relation:=2, FormulaText:="$AN$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AO$25", Relation:=2, FormulaText:="$AO$7" SolverAdd CellRef:="$AO$26", Relation:=2, FormulaText:="$AO$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AP$25", Relation:=2, FormulaText:="$AP$7" SolverAdd CellRef:="$AP$26", Relation:=2, FormulaText:="$AP$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$B$25", Relation:=2, FormulaText:="$AR$25" SolverAdd CellRef:="$B$26", Relation:=2, FormulaText:="$AR$26" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$R$25", Relation:=3, FormulaText:="0" SolverAdd CellRef:="$R$26", Relation:=3, FormulaText:="0" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$S$25", Relation:=2, FormulaText:="500" SolverAdd CellRef:="$S$26", Relation:=2, FormulaText:="500" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$T$25", Relation:=2, FormulaText:="0" SolverAdd CellRef:="$T$26", Relation:=2, FormulaText:="0" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$X$25", Relation:=2, FormulaText:="0" SolverAdd CellRef:="$X$26", Relation:=2, FormulaText:="0" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$Y$25", Relation:=2, FormulaText:="0" SolverAdd CellRef:="$Y$26", Relation:=2, FormulaText:="0" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$Z$25", Relation:=2, FormulaText:="0" SolverAdd CellRef:="$Z$26", Relation:=2, FormulaText:="0" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverSolve End Sub
[/vba]
Добрый день! Записал макрос для замены строк в ограничениях Поиска решения. Как сделать так, чтобы это же действие повторялось до 52 строки? [vba]Код
Sub Макрос1() ' ' Макрос1 Макрос ' ' SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AA$25", Relation:=2, FormulaText:="0" SolverAdd CellRef:="$AA$26", Relation:=2, FormulaText:="0" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AI$25", Relation:=2, FormulaText:="$AI$7" SolverAdd CellRef:="$AI$26", Relation:=2, FormulaText:="$AI$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AJ$25", Relation:=2, FormulaText:="$AJ$7" SolverAdd CellRef:="$AJ$26", Relation:=2, FormulaText:="$AJ$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AK$25", Relation:=2, FormulaText:="$AK$7" SolverAdd CellRef:="$AK$26", Relation:=2, FormulaText:="$AK$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AL$25", Relation:=2, FormulaText:="$AL$7" SolverAdd CellRef:="$AL$26", Relation:=2, FormulaText:="$AL$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AM$25", Relation:=2, FormulaText:="$AM$7" SolverAdd CellRef:="$AM$26", Relation:=2, FormulaText:="$AM$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AN$25", Relation:=2, FormulaText:="$AN$7" SolverAdd CellRef:="$AN$26", Relation:=2, FormulaText:="$AN$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AO$25", Relation:=2, FormulaText:="$AO$7" SolverAdd CellRef:="$AO$26", Relation:=2, FormulaText:="$AO$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AP$25", Relation:=2, FormulaText:="$AP$7" SolverAdd CellRef:="$AP$26", Relation:=2, FormulaText:="$AP$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$B$25", Relation:=2, FormulaText:="$AR$25" SolverAdd CellRef:="$B$26", Relation:=2, FormulaText:="$AR$26" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$R$25", Relation:=3, FormulaText:="0" SolverAdd CellRef:="$R$26", Relation:=3, FormulaText:="0" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$S$25", Relation:=2, FormulaText:="500" SolverAdd CellRef:="$S$26", Relation:=2, FormulaText:="500" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$T$25", Relation:=2, FormulaText:="0" SolverAdd CellRef:="$T$26", Relation:=2, FormulaText:="0" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$X$25", Relation:=2, FormulaText:="0" SolverAdd CellRef:="$X$26", Relation:=2, FormulaText:="0" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$Y$25", Relation:=2, FormulaText:="0" SolverAdd CellRef:="$Y$26", Relation:=2, FormulaText:="0" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$Z$25", Relation:=2, FormulaText:="0" SolverAdd CellRef:="$Z$26", Relation:=2, FormulaText:="0" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverSolve End Sub
[/vba] nechehov
Сообщение отредактировал nechehov - Суббота, 03.06.2017, 18:28
Ответить
Сообщение Добрый день! Записал макрос для замены строк в ограничениях Поиска решения. Как сделать так, чтобы это же действие повторялось до 52 строки? [vba]Код
Sub Макрос1() ' ' Макрос1 Макрос ' ' SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AA$25", Relation:=2, FormulaText:="0" SolverAdd CellRef:="$AA$26", Relation:=2, FormulaText:="0" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AI$25", Relation:=2, FormulaText:="$AI$7" SolverAdd CellRef:="$AI$26", Relation:=2, FormulaText:="$AI$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AJ$25", Relation:=2, FormulaText:="$AJ$7" SolverAdd CellRef:="$AJ$26", Relation:=2, FormulaText:="$AJ$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AK$25", Relation:=2, FormulaText:="$AK$7" SolverAdd CellRef:="$AK$26", Relation:=2, FormulaText:="$AK$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AL$25", Relation:=2, FormulaText:="$AL$7" SolverAdd CellRef:="$AL$26", Relation:=2, FormulaText:="$AL$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AM$25", Relation:=2, FormulaText:="$AM$7" SolverAdd CellRef:="$AM$26", Relation:=2, FormulaText:="$AM$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AN$25", Relation:=2, FormulaText:="$AN$7" SolverAdd CellRef:="$AN$26", Relation:=2, FormulaText:="$AN$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AO$25", Relation:=2, FormulaText:="$AO$7" SolverAdd CellRef:="$AO$26", Relation:=2, FormulaText:="$AO$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$AP$25", Relation:=2, FormulaText:="$AP$7" SolverAdd CellRef:="$AP$26", Relation:=2, FormulaText:="$AP$7" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$B$25", Relation:=2, FormulaText:="$AR$25" SolverAdd CellRef:="$B$26", Relation:=2, FormulaText:="$AR$26" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$R$25", Relation:=3, FormulaText:="0" SolverAdd CellRef:="$R$26", Relation:=3, FormulaText:="0" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$S$25", Relation:=2, FormulaText:="500" SolverAdd CellRef:="$S$26", Relation:=2, FormulaText:="500" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$T$25", Relation:=2, FormulaText:="0" SolverAdd CellRef:="$T$26", Relation:=2, FormulaText:="0" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$X$25", Relation:=2, FormulaText:="0" SolverAdd CellRef:="$X$26", Relation:=2, FormulaText:="0" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$Y$25", Relation:=2, FormulaText:="0" SolverAdd CellRef:="$Y$26", Relation:=2, FormulaText:="0" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverDelete CellRef:="$Z$25", Relation:=2, FormulaText:="0" SolverAdd CellRef:="$Z$26", Relation:=2, FormulaText:="0" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverOk SetCell:="$B$26", MaxMinVal:=1, ValueOf:=1000, ByChange:= _ "$R$26:$AC$26", Engine:=1, EngineDesc:="GRG Nonlinear" SolverSolve End Sub
[/vba] Автор - nechehov Дата добавления - 03.06.2017 в 17:20