Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ron ron is offline
external usenet poster
 
Posts: 20
Default identify green triangle in cell programatically?

Hello,

I am writing data to Excel 2002 from Access using ADO.
This is fast, but I keep getting the little green
triangles in each cell containing numeric data (it is the
way ADO writes the data to Excel). So I have to manually
convert each cell to number from the green triangle. I
tried using RecordMacro to see what was happening, but
RecordMacro is not recording the conversion. I am
guessing that the manual action is just formatting the
cell to numeric and re-writing the value in the cell. I
want to be able to programatically identify cells with the
little green triangle so that I can do the same thing.
Any suggestions appreciated how to programatically
identify the little green triangle in the cell.

Note: I tried formatting the cells to numeric on the
given workbook and saving the workbook (like a template,
but .xls). This worked, except that the data may be
numeric or chars. If ADO tries to write a char to a
numeric cell, it dies. So I have to leave the cells as
general format.

Thanks,
Ron
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default identify green triangle in cell programatically?

Dim cell as Range
for each cell in worksheet.usedrange _
.specialCells(xlCellTypeFormulas, xlNumbers)
if isnumeric(cell.Value) then
cell.value = cell.value
end if
Next

--
Regards,
Tom Ogilvy

"Ron" wrote in message
...
Hello,

I am writing data to Excel 2002 from Access using ADO.
This is fast, but I keep getting the little green
triangles in each cell containing numeric data (it is the
way ADO writes the data to Excel). So I have to manually
convert each cell to number from the green triangle. I
tried using RecordMacro to see what was happening, but
RecordMacro is not recording the conversion. I am
guessing that the manual action is just formatting the
cell to numeric and re-writing the value in the cell. I
want to be able to programatically identify cells with the
little green triangle so that I can do the same thing.
Any suggestions appreciated how to programatically
identify the little green triangle in the cell.

Note: I tried formatting the cells to numeric on the
given workbook and saving the workbook (like a template,
but .xls). This worked, except that the data may be
numeric or chars. If ADO tries to write a char to a
numeric cell, it dies. So I have to leave the cells as
general format.

Thanks,
Ron



  #3   Report Post  
Posted to microsoft.public.excel.programming
ron ron is offline
external usenet poster
 
Posts: 20
Default identify green triangle in cell programatically?

Thanks for your reply. I tried out this code but kept
getting the error message that no cells were found. I
have a range with 15 columns and 5 rows where all the
cells have the little triangle. All the values in these
cells are numbers, so xlNumbers is probably the correct
arg. I tried most of the dropdown args for the first arg
but just got error for each one, "No cells were found"
or "Unable to get the SpecialCells property of the Range
class".

Is there maybe another arg I could use for xlNumbers?


-----Original Message-----
Dim cell as Range
for each cell in worksheet.usedrange _
.specialCells(xlCellTypeFormulas, xlNumbers)
if isnumeric(cell.Value) then
cell.value = cell.value
end if
Next

--
Regards,
Tom Ogilvy

"Ron" wrote in

message
...
Hello,

I am writing data to Excel 2002 from Access using ADO.
This is fast, but I keep getting the little green
triangles in each cell containing numeric data (it is

the
way ADO writes the data to Excel). So I have to

manually
convert each cell to number from the green triangle. I
tried using RecordMacro to see what was happening, but
RecordMacro is not recording the conversion. I am
guessing that the manual action is just formatting the
cell to numeric and re-writing the value in the cell. I
want to be able to programatically identify cells with

the
little green triangle so that I can do the same thing.
Any suggestions appreciated how to programatically
identify the little green triangle in the cell.

Note: I tried formatting the cells to numeric on the
given workbook and saving the workbook (like a template,
but .xls). This worked, except that the data may be
numeric or chars. If ADO tries to write a char to a
numeric cell, it dies. So I have to leave the cells as
general format.

Thanks,
Ron



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default identify green triangle in cell programatically?

No, xlNumbers isn't the right argument - I got myself turned around and
going backwards - my apologies. xlTextValues is the right argument since
the storage of numbers as text is what is causing the error triangles.

Dim cell as Range
Dim rng as Range
On Error Resume Next
set rng = worksheet.usedrange _
.specialCells(xlCellTypeFormulas, xlTextValues)
On Error goto 0
if not rng is nothing then
for each cell in rng
if isnumeric(cell.Value) then
cell.NumberFormat = "0" ' or whatever is appropriate
' unless you want to keep the format as general or text
' whatever it is now.
cell.value = cell.value
end if
Next

--
Regards,
Tom Ogilvy




"Ron" wrote in message
...
Thanks for your reply. I tried out this code but kept
getting the error message that no cells were found. I
have a range with 15 columns and 5 rows where all the
cells have the little triangle. All the values in these
cells are numbers, so xlNumbers is probably the correct
arg. I tried most of the dropdown args for the first arg
but just got error for each one, "No cells were found"
or "Unable to get the SpecialCells property of the Range
class".

Is there maybe another arg I could use for xlNumbers?


-----Original Message-----
Dim cell as Range
for each cell in worksheet.usedrange _
.specialCells(xlCellTypeFormulas, xlNumbers)
if isnumeric(cell.Value) then
cell.value = cell.value
end if
Next

--
Regards,
Tom Ogilvy

"Ron" wrote in

message
...
Hello,

I am writing data to Excel 2002 from Access using ADO.
This is fast, but I keep getting the little green
triangles in each cell containing numeric data (it is

the
way ADO writes the data to Excel). So I have to

manually
convert each cell to number from the green triangle. I
tried using RecordMacro to see what was happening, but
RecordMacro is not recording the conversion. I am
guessing that the manual action is just formatting the
cell to numeric and re-writing the value in the cell. I
want to be able to programatically identify cells with

the
little green triangle so that I can do the same thing.
Any suggestions appreciated how to programatically
identify the little green triangle in the cell.

Note: I tried formatting the cells to numeric on the
given workbook and saving the workbook (like a template,
but .xls). This worked, except that the data may be
numeric or chars. If ADO tries to write a char to a
numeric cell, it dies. So I have to leave the cells as
general format.

Thanks,
Ron



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
ron ron is offline
external usenet poster
 
Posts: 20
Default identify green triangle in cell programatically?

Thanks again for getting back to me on this. Well, I gave
it a try. With the On Error Resume Next, the code didn't
die this time, but rng did not get set. It just resumed
out. I even tried setting rng to a specific range
("B20:N24") for example, where I have the little green
thigns. No luck, still. I even created my own triangles
where I format a range of cells as text and place
numbers. Still, rng doesn't get set.

My alternative that I did was to designate one static
range like "A1:N50".
Dim x As Variant
For...
For...
If IsNumeric(rng(i,j)) Then
rng(i,j).NumberFormat = "0"
x = rng(i,j)
rng(i,j) = x
End If

This actually, gets rid of the triangles. But I would
like to be able to use the cool properties like
SpecialCells. May I request if you could try your code on
a specific set of cells with the greenies (without resume
next)? If it works for you, then maybe I need to make a
reference to some library? I am using the default
references of Excel Obj Lib 10.0, VB for Apps, VB for Apps
Ext, ...

Thanks again,
Ron


-----Original Message-----
No, xlNumbers isn't the right argument - I got myself

turned around and
going backwards - my apologies. xlTextValues is the

right argument since
the storage of numbers as text is what is causing the

error triangles.

Dim cell as Range
Dim rng as Range
On Error Resume Next
set rng = worksheet.usedrange _
.specialCells(xlCellTypeFormulas, xlTextValues)
On Error goto 0
if not rng is nothing then
for each cell in rng
if isnumeric(cell.Value) then
cell.NumberFormat = "0" ' or whatever is appropriate
' unless you want to keep the format as general or

text
' whatever it is now.
cell.value = cell.value
end if
Next

--
Regards,
Tom Ogilvy




"Ron" wrote in

message
...
Thanks for your reply. I tried out this code but kept
getting the error message that no cells were found. I
have a range with 15 columns and 5 rows where all the
cells have the little triangle. All the values in these
cells are numbers, so xlNumbers is probably the correct
arg. I tried most of the dropdown args for the first

arg
but just got error for each one, "No cells were found"
or "Unable to get the SpecialCells property of the Range
class".

Is there maybe another arg I could use for xlNumbers?


-----Original Message-----
Dim cell as Range
for each cell in worksheet.usedrange _
.specialCells(xlCellTypeFormulas, xlNumbers)
if isnumeric(cell.Value) then
cell.value = cell.value
end if
Next

--
Regards,
Tom Ogilvy

"Ron" wrote in

message
...
Hello,

I am writing data to Excel 2002 from Access using

ADO.
This is fast, but I keep getting the little green
triangles in each cell containing numeric data (it is

the
way ADO writes the data to Excel). So I have to

manually
convert each cell to number from the green

triangle. I
tried using RecordMacro to see what was happening,

but
RecordMacro is not recording the conversion. I am
guessing that the manual action is just formatting

the
cell to numeric and re-writing the value in the

cell. I
want to be able to programatically identify cells

with
the
little green triangle so that I can do the same

thing.
Any suggestions appreciated how to programatically
identify the little green triangle in the cell.

Note: I tried formatting the cells to numeric on the
given workbook and saving the workbook (like a

template,
but .xls). This worked, except that the data may be
numeric or chars. If ADO tries to write a char to a
numeric cell, it dies. So I have to leave the cells

as
general format.

Thanks,
Ron


.



.



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
removing green triangle in cell Shooter Excel Worksheet Functions 4 May 7th 23 11:45 AM
Green Triangle in Upper Left Corner of Cell Clueless in Seattle New Users to Excel 2 November 27th 07 04:39 AM
green triangle top left corner of cell in Excel Bobbi Excel Discussion (Misc queries) 1 November 12th 07 06:41 PM
Green Triangle in Cell M. B. Collins Excel Discussion (Misc queries) 4 August 8th 06 01:46 AM
green triangle in date cell alexanderd[_6_] Excel Programming 1 May 17th 04 11:34 AM


All times are GMT +1. The time now is 11:33 PM.

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

About Us

"It's about Microsoft Excel"