KateWantsToLearn
New Member
- Joined
- Jun 30, 2010
- Messages
- 8
Hi there!
I'm trying to do a goal seek with an offset but i haven't written code (and even when I did only took an intro class) in 5 years! Sos
I am trying to change the value in SHEET1 cell E49 equal to the VALUE in cell E436 on the same sheet ("SHEET1") by changing cell E38 on tab SHEET 2. I have no problem doing this with the following code:
<!-- BEGIN TEMPLATE: bbcode_quote -->
Quote:
<TABLE cellSpacing=0 cellPadding=6 width="100%" border=0><TBODY><TR><TD class=alt2 style="BORDER-RIGHT: 1px inset; BORDER-TOP: 1px inset; BORDER-LEFT: 1px inset; BORDER-BOTTOM: 1px inset">Worksheets("SHEET1").Range("e49").GoalSeek Goal:=Range("e436").Value, changingcell:=Worksheets("SHEET2").Range("e38") </TD></TR></TBODY></TABLE>
<!-- END TEMPLATE: bbcode_quote -->But I need to perform this same function for 150 columns (column e is the first one, so it goes throught column ex). I tried making the code below, but aside from all of the other things that you'll clearly see are wrong with it, I think this would offset my first value, too, when I would want to have the very first iteration (column e) not be offset. I assume i need some sort of i +1 or something?
<!-- BEGIN TEMPLATE: bbcode_quote -->
Quote:
<TABLE cellSpacing=0 cellPadding=6 width="100%" border=0><TBODY><TR><TD class=alt2 style="BORDER-RIGHT: 1px inset; BORDER-TOP: 1px inset; BORDER-LEFT: 1px inset; BORDER-BOTTOM: 1px inset">Dim CELL as range
For Each CELL In worksheets(“sheet2”).Range("e38:ex150")
Application.Goto Worksheets("sheet1").Range("e49").Offset(0, 1)
ActiveCell.GoalSeek Goal:=ActiveCell.Offset(0, 1).Range_("e436"), changingcell:=ActiveCell.Offset(0, 1).worksheets(“sheet2”).Range_("e38") </TD></TR></TBODY></TABLE>
<!-- END TEMPLATE: bbcode_quote -->Some help, pretty please?
Also...eventually i will need to repeat the corrected macro that calcs for e:ex every 12th row (i'm afraid my excel will implode!) - if you could help with that, too, that'd be awesome, but maybe i can figure that out after seeing the answer...
Happy Fourth of July!<!-- / message --><!-- BEGIN TEMPLATE: ad_showthread_firstpost_sig --><!-- END TEMPLATE: ad_showthread_firstpost_sig -->
I'm trying to do a goal seek with an offset but i haven't written code (and even when I did only took an intro class) in 5 years! Sos

I am trying to change the value in SHEET1 cell E49 equal to the VALUE in cell E436 on the same sheet ("SHEET1") by changing cell E38 on tab SHEET 2. I have no problem doing this with the following code:
<!-- BEGIN TEMPLATE: bbcode_quote -->
Quote:
<TABLE cellSpacing=0 cellPadding=6 width="100%" border=0><TBODY><TR><TD class=alt2 style="BORDER-RIGHT: 1px inset; BORDER-TOP: 1px inset; BORDER-LEFT: 1px inset; BORDER-BOTTOM: 1px inset">Worksheets("SHEET1").Range("e49").GoalSeek Goal:=Range("e436").Value, changingcell:=Worksheets("SHEET2").Range("e38") </TD></TR></TBODY></TABLE>
<!-- END TEMPLATE: bbcode_quote -->But I need to perform this same function for 150 columns (column e is the first one, so it goes throught column ex). I tried making the code below, but aside from all of the other things that you'll clearly see are wrong with it, I think this would offset my first value, too, when I would want to have the very first iteration (column e) not be offset. I assume i need some sort of i +1 or something?
<!-- BEGIN TEMPLATE: bbcode_quote -->
Quote:
<TABLE cellSpacing=0 cellPadding=6 width="100%" border=0><TBODY><TR><TD class=alt2 style="BORDER-RIGHT: 1px inset; BORDER-TOP: 1px inset; BORDER-LEFT: 1px inset; BORDER-BOTTOM: 1px inset">Dim CELL as range
For Each CELL In worksheets(“sheet2”).Range("e38:ex150")
Application.Goto Worksheets("sheet1").Range("e49").Offset(0, 1)
ActiveCell.GoalSeek Goal:=ActiveCell.Offset(0, 1).Range_("e436"), changingcell:=ActiveCell.Offset(0, 1).worksheets(“sheet2”).Range_("e38") </TD></TR></TBODY></TABLE>
<!-- END TEMPLATE: bbcode_quote -->Some help, pretty please?
Also...eventually i will need to repeat the corrected macro that calcs for e:ex every 12th row (i'm afraid my excel will implode!) - if you could help with that, too, that'd be awesome, but maybe i can figure that out after seeing the answer...
Happy Fourth of July!<!-- / message --><!-- BEGIN TEMPLATE: ad_showthread_firstpost_sig --><!-- END TEMPLATE: ad_showthread_firstpost_sig -->