I have tried the following code and can't get the other cells to change.
I am trying to get information returned to my userform when I type in the name of a project. As you can see from the code I have about 45 columns to pull info from that relate to a project. Ideally I'd like to be able to use a combo box to select the existing project.
Can someone tell me what I'm doing wrong?
Private Sub PROJECTNAME_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim c As Range, ws As Worksheet
Application.ScreenUpdating = False
Set ws = Worksheets("Database")
If PROJECTNAME.Text = "" Then
Exit Sub
End If
Sheets("Database").Activate
For Each c In ws.Range("A1:A1000")
If c.Value = PROJECTNAME.Text Then
c.Activate
DEPARTMENT.Text = Cells(r, 2)
AIRPORT.Text = Cells(r, 3)
CARRYOVER.Text = Cells(r, 4)
PROJSTARTDATE.Text = Cells(r, 5)
PROJNUMBER.Text = Cells(r, 6)
SUBMITTEDBY.Text = Cells(r, 7)
SPONSOR.Text = Cells(r, 8)
DATESUBMITTED.Text = Cells(r, 9)
AIRLINEAPPROVALYEAR.Text = Cells(r, 10)
REGULATORY.Value = Cells(r, 11)
STRATEGICGROWTH.Value = Cells(r, 12)
LIFEEXPECTANCY.Value = Cells(r, 13)
SERVICEQUALITY.Value = Cells(r, 14)
ECONOMICDEVELOPMENT.Value = Cells(r, 15)
INFRADEV.Value = Cells(r, 16)
IMPROVEEFF.Value = Cells(r, 17)
GRANTFUNDING.Value = Cells(r, 18)
BUD2006.Text = Cells(r, 19)
REF2006.Text = Cells(r, 20)
BUDTOTAL.Text = Cells(r, 21)
PRE2007.Text = Cells(r, 22)
BUD2007.Text = Cells(r, 23)
BUD2008.Text = Cells(r, 24)
BUD2009.Text = Cells(r, 25)
BUD2010.Text = Cells(r, 26)
FUTUREYEARS.Text = Cells(r, 27)
YEAROFCOMPLETION.Text = Cells(r, 28)
ASSETLIFE.Text = Cells(r, 29)
FUTUREMAINTCOSTS.Text = Cells(r, 30)
FUTUREOPCOSTS.Text = Cells(r, 31)
ADDITIONALSTAFF.Text = Cells(r, 32)
INCNETREVENUE.Text = Cells(r, 33)
INCEXPENSESAV.Text = Cells(r, 34)
STAFFREDUCTIONS.Text = Cells(r, 35)
PAYPACKPERIOD.Text = Cells(r, 36)
INTERNALRR.Text = Cells(r, 37)
FEDSTATE.Text = Cells(r, 38)
PFC.Text = Cells(r, 39)
CIF.Text = Cells(r, 40)
OTHER.Text = Cells(r, 41)
TOTALFUND.Text = Cells(r, 42)
COSTALLOC.Text = Cells(r, 43)
End If
Next
Sheets("Database").Activate
Application.ScreenUpdating = True
End Sub