Reference textbox data from excel function
I have created textbox1 on an excel spreadsheet and placed a number in it. I have written a function to get that number into an excel cell:
Public Function GetValue(Obj as Object)
Dim x as String
x = Obj.Value
GetValue = x
End Function
then in excel cell I call function:
=GetValue(TextBox1)
I can't get this work and feel I must be missing something pretty basic. It would be very valuable to be able to place data in textboxes, comboxes, etc. and then reference that data in excel functions for use use in excel formulas.
Regards, Dennis ;)
Re: Reference textbox data from excel function
Are you doing this only in Excels VBA or automating Excel from VB 6?
Re: Reference textbox data from excel function
I am doing this in excel vba - 1) Open excel and create textbox 2) Switch (Alt+F11) to VBA and write function 3)Switch back (Alt+F11) to excel sheet and try to use function. I can access contains via a Sub procedure and write to excel cell. The funtion would be much more powerful. Regards, dencur
Re: Reference textbox data from excel function
Moved to Office Development.