ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   deaking with nulls, I think... (https://www.excelbanter.com/excel-programming/342274-deaking-nulls-i-think.html)

Jim May

deaking with nulls, I think...
 
the below code is bombing if it finds a null in a field of my lookup table;
how can I prevent this?

Private Sub cbVenCode_AfterUpdate()
Set MyVenTable = Range("VenTable")
txtVenName.Value = Application.VLookup(Me.cbVencode, MyVenTable, 2,
False)
txtVAdd1.Value = Application.VLookup(Me.cbVencode, MyVenTable, 3, False)
txtVAdd2.Value = Appliction.VLookup(Me.cbVencode, MyVenTable, 4, False)
txtCity.Value = Application.VLookup(Me.cbVencode, MyVenTable, 5, False)
txtSt.Value = Application.VLookup(Me.cbVencode, MyVenTable, 6, False)
txtZip.Value = Application.VLookup(Me.cbVencode, MyVenTable, 7, False)
End Sub



Jim May

deaking with nulls, I think...
 
Never mind,,,
just discovered miss-spelling of application in my faulty line
txtVAdd2.Value...
Jim


"Jim May" wrote in message
news:kUP1f.2956$jw6.2189@lakeread02...
the below code is bombing if it finds a null in a field of my lookup
table; how can I prevent this?

Private Sub cbVenCode_AfterUpdate()
Set MyVenTable = Range("VenTable")
txtVenName.Value = Application.VLookup(Me.cbVencode, MyVenTable, 2,
False)
txtVAdd1.Value = Application.VLookup(Me.cbVencode, MyVenTable, 3,
False)
txtVAdd2.Value = Appliction.VLookup(Me.cbVencode, MyVenTable, 4, False)
txtCity.Value = Application.VLookup(Me.cbVencode, MyVenTable, 5, False)
txtSt.Value = Application.VLookup(Me.cbVencode, MyVenTable, 6, False)
txtZip.Value = Application.VLookup(Me.cbVencode, MyVenTable, 7, False)
End Sub




David McRitchie

deaking with nulls, I think...
 
Thanks for responding to your own question, sure beats
adding unnecessary ON ERROR conditions.

"Jim May" wrote in message news:%IQ1f.2962$jw6.2344@lakeread02...
Never mind,,,
just discovered miss-spelling of application in my faulty line
txtVAdd2.Value...
Jim





All times are GMT +1. The time now is 12:36 AM.

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