Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Macro Auto Change Cell References

The problem is that your cell id's are just text strings. They do not
adjust. Set up a Defined Name in the worksheet, say benign to cover cell
D54, then instead of:

SolverOk SetCell:="D54"

you can use:

Dim s As String
s = Range("benign").Address(RowAbsolute:=False, ColumnAbsolute:=False)
SolverOk SetCell:=s

The Named Range "benign" will adjust as rows/columns are inserted/deleted.
--
Gary''s Student - gsnu200774


"Chrissie" wrote:

Hello,

I have a macro which uses the solve function to solve for various cells in
my worksheet. The problem is I have noticed whenever I am working on my sheet
and insert/delete a column and/or row my macro's cell reference values do not
change automatically. (Like a formula within a worksheet change automatically
when you insert rows above it)

Here is an example of my macro code:
SolverOk SetCell:="D54", MaxMinVal:=1, ValueOf:="0", ByChange:="D57"
SolverAdd CellRef:="D54", Relation:=2, FormulaText:="D55"

Any suggestions? Thanks.

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
An auto macro to change color of the active cell Weaver Dean[_2_] Excel Programming 1 December 3rd 07 11:41 PM
Macro to change chart references Jobe Excel Programming 10 October 24th 07 08:03 PM
Cell references auto update when sorting Chris Excel Discussion (Misc queries) 3 March 8th 07 04:34 PM
Auto Update Cell (Row) References joecrabtree Excel Programming 3 December 8th 06 01:42 PM
Change in cell from formula to auto run a macro Alex Martins[_2_] Excel Programming 10 August 22nd 06 09:57 PM


All times are GMT +1. The time now is 05:16 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"