Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default number format when returning value from odbc connection

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,

--
MS SBS 2003 SP2
--
MS SBS 2003 SP2
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default number format when returning value from odbc connection

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


--
Gary''s Student - gsnu200735


"Mentos" wrote:

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,

--
MS SBS 2003 SP2
--
MS SBS 2003 SP2

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default number format when returning value from odbc connection

thank you, i didnt think about simulating a keyboard stroke but i understand
the theory. works perfect if i do it manually.

however, when i stick the code in the macro, it doesnt produce the desired
result. when i debug and investigate further, it seems i cant get the
Application.SendKeys method to work at all. do you have any further ideas?

many thanks in advance,

--
MS SBS 2003 SP2


"Gary''s Student" wrote:

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


--
Gary''s Student - gsnu200735


"Mentos" wrote:

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,

--
MS SBS 2003 SP2
--
MS SBS 2003 SP2

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ODBC connection failed. Jim Moberg Excel Discussion (Misc queries) 0 October 9th 06 03:53 PM
ODBC Connection Kezzemil Excel Programming 0 October 6th 06 09:15 AM
ODBC connection question matelot Excel Programming 1 September 23rd 06 08:46 PM
ODBC Connection Adrian T[_4_] Excel Programming 4 January 25th 05 08:55 PM
ODBC connection by udl Dorothy[_4_] Excel Programming 1 January 8th 04 05:32 PM


All times are GMT +1. The time now is 03:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"