ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add custom property to a listbox? (https://www.excelbanter.com/excel-programming/357114-add-custom-property-listbox.html)

mkweaver

Add custom property to a listbox?
 
I know I've seen information on how to do this but now can't find it.

I have several textboxs on a userform that I want to link to a cells. I
want the textbox to have a property that points to the cell. I have the
following class:
'############## begin code ################
Option Explicit

Public WithEvents tbLength As MSForms.TextBox
Private rngSource As Range

Property Let rngSource(rngS As Range)
If Not rngS.Address = rngSource.Address Then
rngSource = rngS
tbLength.Text = rngSource.Text
End If
End Property

Property Get rngSource()
rngSource = rngSource
End Property


Private Sub tbLength_Change()
rngSource.Formula = "=" & tbLength.Text
End Sub

'############## end code ################

Now I have two issues, the first being - will this work? and the second
being, how do I add this to my control toolbox?

Any help is appreciated.

Mike




All times are GMT +1. The time now is 10:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com