Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Calling sub procedure

Hi,
I have the following code, that fails on the line where I call the sub
procedure from the Worsheet_Activate procedure. The error is 1004 "The macro
Calculate_AC cannot be found"
Why can't it find the macro?
(The CalcDodgeBonus() and CalcArmorBonus() are functions that also exist and
work on the sheet)

thanks

Private Sub Worksheet_Activate()
Application.Run "Calculate_AC"

End Sub

Private Sub Calculate_AC()
Dim BaseArmorClass As Integer
Dim DexterityBonus As Integer
Dim SizeArmor As Double
Dim DodgeBonus As Integer
Dim WornArmorBonus As Integer
Dim size As Range

Set size = ThisWorkbook.Names("Size").RefersToRange
BaseArmorClass = 10
DexterityBonus = Range("F9").Value
SizeArmor = Application.WorksheetFunction.Match(Range("I30").V alue,
size, 0) - 3
DodgeBonus = CalcDodgeBonus()
WornArmorBonus = CalcArmorBonus()

ArmorClass = BaseArmorClass + DexterityBonus + SizeArmor + DodgeBonus
Range("C26").Value = ArmorClass
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Calling sub procedure

Hi,

Why not try replacing application.run, with just Call?

Ashman

"Yossi" wrote:

Hi,
I have the following code, that fails on the line where I call the sub
procedure from the Worsheet_Activate procedure. The error is 1004 "The macro
Calculate_AC cannot be found"
Why can't it find the macro?
(The CalcDodgeBonus() and CalcArmorBonus() are functions that also exist and
work on the sheet)

thanks

Private Sub Worksheet_Activate()
Application.Run "Calculate_AC"

End Sub

Private Sub Calculate_AC()
Dim BaseArmorClass As Integer
Dim DexterityBonus As Integer
Dim SizeArmor As Double
Dim DodgeBonus As Integer
Dim WornArmorBonus As Integer
Dim size As Range

Set size = ThisWorkbook.Names("Size").RefersToRange
BaseArmorClass = 10
DexterityBonus = Range("F9").Value
SizeArmor = Application.WorksheetFunction.Match(Range("I30").V alue,
size, 0) - 3
DodgeBonus = CalcDodgeBonus()
WornArmorBonus = CalcArmorBonus()

ArmorClass = BaseArmorClass + DexterityBonus + SizeArmor + DodgeBonus
Range("C26").Value = ArmorClass
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
Calling procedure from another WKB with parameters Ajit Excel Programming 5 November 18th 04 10:43 PM
Calling a procedure in a procedure Norman Jones Excel Programming 8 August 20th 04 07:53 PM
Calling a procedure in a procedure N10 Excel Programming 2 August 18th 04 12:49 AM
Calling a procedure in a procedure Don Guillett[_4_] Excel Programming 1 August 17th 04 11:31 PM
Calling a .Net Procedure from a Macro Scott Eguires Excel Programming 0 December 10th 03 10:35 PM


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