I am new to VB programming. Can't figure out what I'm doing wrong here:
Dim somevariable as Integer
somevariable = WorksheetFunction.QUOTIENT(Range(Sheet1!A1), Range(Sheet1!B1))
Thanks
I am new to VB programming. Can't figure out what I'm doing wrong here:
Dim somevariable as Integer
somevariable = WorksheetFunction.QUOTIENT(Range(Sheet1!A1), Range(Sheet1!B1))
Thanks
Completely new answer as of given details. You are working with VBA
so you can call WorksheetFunctions like
Dim someVariable
someVariable = WorksheetFunction.Quotient(Worksheets("Sheet1").Cells(1, "A").Value, Worksheets("Sheet1").Cells(1, "B").Value)
Debug.Print someVariable
There is a quite good list of supported functions available on MSDN WorksheetFunction. Please choose your current Excel version on the linked page.
Furthermore I found another very important site concerning your problem that states that not all WorksheetFunctions are supported as Application. (see support.microsoft.com)
So I searched for workarounds and found a quite simple one on StackOverflow. But on the other hand - you really could make use of the VBA builtIn operator MOD
' created some variables, as I made some attempts on creating a good example
Dim value1
value1 = Worksheets("Sheet1").Cells(1, "A").Value
Dim value2
value2 = Worksheets("Sheet1").Cells(1, "B").Value
someVariable = value1 Mod value2
Debug.Print someVariable
' of course you may use a single line statement too
someVariable = Worksheets("Tabelle1").Cells(1, "A").Value Mod Worksheets("Tabelle1").Cells(1, "B").Value
I think there are some pretty good links to have a deeper look into.
Try this
somevariable = WorksheetFunction.QUOTIENT(Worksheets("Sheet1").Range(A1), Worksheets("Sheet1").Range(B1))