Newbie Question
I am sure the answer is somewhere, but I can't seem to find it. I am
trying to add a user function to an Excel sheet so that anyone in the sheet can use the function in a cell. Is this possible? I am fairly competent with VB, so the inner code is not an issue. Can someone point me in the right direction or post a sample code that does something simple like adding 1 to a cell. Thanks in advance. |
Newbie Question
Random,
Open the VBA Editor and go to the Insert menu, and choose Module. This will add a new code module to the VBProject of the workbook. In that module, enter your code, something like Public Function TimesTwo(V As Double) As Double TimesTwo = V * 2 End Function Then, you can call this function directly from the worksheet with a formula like =TimesTwo(5) -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Random" <Random@nwhere wrote in message ... I am sure the answer is somewhere, but I can't seem to find it. I am trying to add a user function to an Excel sheet so that anyone in the sheet can use the function in a cell. Is this possible? I am fairly competent with VB, so the inner code is not an issue. Can someone point me in the right direction or post a sample code that does something simple like adding 1 to a cell. Thanks in advance. |
All times are GMT +1. The time now is 10:37 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com