Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Macro that uses data in a cell

Status
Not open for further replies.

DanAuber

IS-IT--Management
Apr 28, 2000
255
0
0
FR
I have a very simple macro as follows:

Sub Run_Cap_Rate_A()
Range("AF8").GoalSeek Goal:=0, ChangingCell:=Range("C7")
End Sub

I want to change the code so that the Range("AF8") bit varies according to what is in cells in a sheet.

In my sheet I have a column number in Cell A1 and a Row number in cell A2.

I want to macro to pick these values up and use them instead of AF8. Thus for example if A1 has 2 and A2 has 5 - this makes B5 for the range.

Slowly going mad trying to change the macro code to be dynamic as described. Would be grateful for some help on something that is probably very simple !

Thanks

Dan



 
Hi Dan,

Try:
Sub Run_Cap_Rate_A()
Cells(Range("A2").Value, Range("A1").Value).GoalSeek Goal:=0, ChangingCell:=Range("C7")
End Sub

Cheers
Paul Edstein
[MS MVP - Word]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top