#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default GoalSeek in VBA

When if running this code I get the following error, anyone who know
what the problem is?

Error:
"Method 'Range' of object '_Global' failed"


Sub GoalSeekMacro()

Source = Worksheets("Olie og gas").Cells(9, 15).Value
ResultCell = "n9"
Result = 20
Range(ResultCell).GoalSeek goal:=Result,
ChangingCell:=Range(Source)

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 179
Default GoalSeek in VBA

Hi

Use below mentioned macro:

Sub GoalSeekMacro()

Dim rngS As Range
Dim rngD As Range
Set rngS = Range("O8")
Set rngD = Range("N9")
Result = 20
rngD.GoalSeek Goal:=Result, ChangingCell:=rngS

End Sub



" wrote:

When if running this code I get the following error, anyone who know
what the problem is?

Error:
"Method 'Range' of object '_Global' failed"


Sub GoalSeekMacro()

Source = Worksheets("Olie og gas").Cells(9, 15).Value
ResultCell = "n9"
Result = 20
Range(ResultCell).GoalSeek goal:=Result,
ChangingCell:=Range(Source)

End Sub


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
Goalseek / Solver Target Value msnews.microsoft.com Excel Worksheet Functions 1 December 2nd 05 01:41 PM


All times are GMT +1. The time now is 06:39 AM.

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"