[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 74
  • Last Modified:

Value from a cell used in a module

Folks,
In my worksheet at P13 there's this following function:
=COVAR(M6:M13,N6:N13). With the provided data this returns a value of 16.25 is returned as a positive number. P13 is a dynamic value.
The code below says that the value in P13 is empty at line 3? The code is a modular and is attached to an form radio button object.
Sub EvalCovarPositive()

If Range("P13").Value > 0 Then
MsgBox ("Correct - a positive Covariance indicates that the values move together")
Else
MsgBox ("Incorrect - When a value is negative the Covariance indicates that the values move inversely")
End If
End Sub

Open in new window

0
Frank Freese
Asked:
Frank Freese
  • 2
1 Solution
 
Rgonzo1971Commented:
Hi,

the code is fine, maybe you should define the sheet

Sub EvalCovarPositive()

If Worksheets("Sheet1").Range("P13").Value > 0 Then
MsgBox ("Correct - a positive Covariance indicates that the values move together")
Else
MsgBox ("Incorrect - When a value is negative the Covariance indicates that the values move inversely")
End If
End Sub

Regards
0
 
Frank FreeseAuthor Commented:
Do you think it would help if I referenced the correct cell add P14 and not P13......it made a big difference. Stupidity is in the eye of the beholder as I stand in front of the mirror.

Thanks in affirming my code was not the problem.
0
 
Frank FreeseAuthor Commented:
Thanks - I appreciate your help!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now