Hi All!
1) In the Visual Basic Editor I want to know what is the correct way to refer to a cell so I can use its value in a calculation?
Here's my code:
Function CalcValue(Arg1 As String, Arg2 As String) As Long
If Arg1 = "1" And Arg2 = "2" Then
CalcValue = Worksheets("SheetName").Range("B14").Value * 2.5
ElseIf Arg1 = "2" And Arg2 = "2" Then
CalcValue = 76
End If
End Function
I've also tried:
CalcValue = Worksheets("SheetName").Cells(14, 2) * 2.5
but it didn't work.
The cell in Excel has this formula:
=calcValue(C14;F14)
2) How do I comment code in the VB Editor (like the // in PHP and -- in Lingo)?
Regards
/Rixn
1) In the Visual Basic Editor I want to know what is the correct way to refer to a cell so I can use its value in a calculation?
Here's my code:
Function CalcValue(Arg1 As String, Arg2 As String) As Long
If Arg1 = "1" And Arg2 = "2" Then
CalcValue = Worksheets("SheetName").Range("B14").Value * 2.5
ElseIf Arg1 = "2" And Arg2 = "2" Then
CalcValue = 76
End If
End Function
I've also tried:
CalcValue = Worksheets("SheetName").Cells(14, 2) * 2.5
but it didn't work.
The cell in Excel has this formula:
=calcValue(C14;F14)
2) How do I comment code in the VB Editor (like the // in PHP and -- in Lingo)?
Regards
/Rixn