Formula in userform question

paulnray

New Member
Joined
May 24, 2005
Messages
29
Hi,

This is a two part question that I would reallyappreciate help with.

The first time I used this code it worked but then stopped does anyone know why this might be?

Code:
Private Sub StructureDiv_Change()
If Len(txtCostCentre.Text) = 3 Then
    Label16.Caption = Application.WorksheetFunction. _
        VLookup(txtCostCentre.Text, Worksheets("Org Structure").Range("a1:E700"), 2, False)
End If
End Sub

Also I have 3 parts that need to be updated can I just copy the bit from Label 16 to False) and update it or do i need a seperate bit of code for each change? its all based on the when txtCostCentre reached 3 characters.

Now the next part that I would really like to get working.

I have the following Formula is it possible to convert it so that it becomes the caption for label2

Code:
=TEXT(200,"000")&TEXT("-","")&TEXT(G2,"")&TEXT("-","")&TEXT(MID(INDEX('Reference Numbers'!A:A,5),9,3)+1,"000")&TEXT("-","")&LEFT(I2,2)

The two cells that are used are
G2 = txtCostCentre
I2 = cboOfficer

This is the first time that i have used user forms and they are really good learning so much but this has got me stumped.

Regards

Paul
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Just realised i did a silly basic mistake in the first part and named it the wrong sub name to one that didnt exist and thats why it wasnt working. so solved that.

Now to try and get the second part working.

Paul
 
Upvote 0

Forum statistics

Threads
1,215,635
Messages
6,125,945
Members
449,275
Latest member
jacob_mcbride

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top