Forum Discussion
Gukeli
Mar 21, 2022Copper Contributor
VBA function with 3 arguments in 3 cells to the left of entered cell
I want to make a VBA function that will return a value in decimal degrees, using the degree, minutes and seconds values in the three cells to the left of any cell in which I choose enter the function...
Gukeli
Mar 21, 2022Copper Contributor
Yes, I know how to add things up on an Excel spreadsheet. But if you re-read my post, I hope you will see that I want to create a VBA user function which, when called in any cell of the spreadsheet, will automatically do such a calculation using the values in the three cells to the left of the cell in which the function is entered.
That is a rather more complicated matter.
That is a rather more complicated matter.
Mar 21, 2022
I missed that, try this VBA
Sub Macro1()
ActiveCell.FormulaR1C1 = "=RC[-4]+(RC[-3]/60)+(RC[-2]/3600)"
End Sub
Sub Macro1()
ActiveCell.FormulaR1C1 = "=RC[-4]+(RC[-3]/60)+(RC[-2]/3600)"
End Sub
- GukeliMar 21, 2022Copper ContributorThanks for noting that this is about VBA. But I don't want to have to call a Macro. I am trying to create a VBA user function, which as you know works rather differently.
How would your suggestion look as a user function in a VBA module with the usual Function ... End Function structure?