Textbox changes Cell format to Text

FreakSister286

New Member
Joined
Feb 26, 2011
Messages
6
Excel 2007 Textbox changes LinkedCell Cell format to Text. If I do a VLOOKUP on that cell it fails and I have to "Convert to number".
My application is to enter a ZIPCODE into ZIP textbox, then for CITY and STATE to autofill using VLOOKUP in both CITY and STATE cells.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
This is what I have in VBA:
-----------------
Private Sub ZIP_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyTab Then
Address.Activate
End If
End Sub
-----------------
What code will automatically convert the underlying cell to Number format? and then keydown to my next textbox?
 
Upvote 0
What code puts the value from the textbox into the cell?
 
Upvote 0
Hi Norie,

Thanks for responding. You may not have seen my earlier post so I'll combine the two:

"Excel 2007 Textbox changes LinkedCell Cell format to Text. If I do a VLOOKUP on that cell it fails and I have to "Convert to number".
My application is to enter a ZIPCODE into ZIP textbox, then for CITY and STATE to autofill using VLOOKUP in both CITY and STATE cells.

This is what I have in VBA:

Code:
Private Sub ZIP_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyTab Then
Address.Activate
End If
End Sub

What code will automatically convert the underlying cell to Number format? and then keydown to my next textbox?"
 
Upvote 0
I think that's the problem - using a linked cell.

The link works both ways, so if you enter anything in the textbox it's put in the cell, and since it's a textbox it's text.

You could probably use code to convert it buy it might be easier to do the conversion in the formula.

For that you can try the VALUE function, something like this where A2 is the linked cell.

=VLOOKUP(VALUE(A2), LookupRange, Column, 0)
 
Upvote 0

Forum statistics

Threads
1,221,811
Messages
6,162,114
Members
451,743
Latest member
matt3388

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