number format when returning value from odbc connection

M

Mentos

hi there,

hope you can help. i have a querytable.add method with odbc connection and
in a particular column that is returned to excel, some values are numeric,
some are alphanumeric. in each cell property, i see the format as "general"
however, if the value is numeric, excel has a little green triangle on the
top left hand corner of the cell. if i hover over it, i get an option to
"convert to number" and i click on it. the green triangle disappears

the reason why i convert is because subsequent vlookup function does not
work on a cell that has not been converted to number, especially when that is
the first column of the table array.

how do i "convert to number" in VBA? i recorded this action with a macro but
the macro doesnt record anything. when i debug my procedure, it is never the
green triangle until the procedure ends

many thanks,
 
G

Gary''s Student

Select the cells you want to fix and run:

Sub fixum()
Set rr = Selection
For Each r In rr
r.Select
Application.SendKeys "{F2}"
Application.SendKeys "{ENTER}"
DoEvents
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top