# Beginner Macro Question

#### secox

##### New Member
I need to set a series of cells to a certain value by changing another serices of cells.

I know I can write a macro like:

Range("G53").GoalSeek Goal:=60000, ChangingCell:=Range("G61")
Range("H53").GoalSeek Goal:=60000, ChangingCell:=Range("H61")
Range("I53").GoalSeek Goal:=60000, ChangingCell:=Range("I61")
Range("J53").GoalSeek Goal:=60000, ChangingCell:=Range("J61")
Range("K53").GoalSeek Goal:=60000, ChangingCell:=Range("K61")
Range("L53").GoalSeek Goal:=60000, ChangingCell:=Range("L61")
Range("m53").GoalSeek Goal:=60000, ChangingCell:=Range("m61")

and so on, but I also know there is a way to do this in one step--I just don't know how. Can anyone tell me how to do this from Column G to Column BP without repeating each line?

### Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
You mean like a loop?

Code:
``````CurrentColumn = 7 ' Column G
LastColumn = 68 ' Column BP

Do Until CurrentColumn > LastColumn
Cells(53, CurrentColumn).GoalSeek Goal:=60000, ChangingCell:=Cells(61, CurrentColumn)
CurrentColumn = CurrentColumn + 1
Loop``````

That was what I was going for. I'll try changing it to something like that.

Replies
0
Views
412
Replies
3
Views
199
Replies
1
Views
339
Replies
9
Views
321
Replies
8
Views
421

1,218,909
Messages
6,145,166
Members
450,592
Latest member
Boulder127

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back