Solved

Getting data from Excel

Posted on 2004-08-23
3
162 Views
Last Modified: 2010-05-02
Hi,

From Visual Basic I need to open an Excel worksheet and retrieve all rows which either have a blue background or blue text. Now, I can open the worksheet but is there anyway to retirve the relevant rows rather than just looping through them all?

Thanks in advance,
Dan
0
Comment
Question by:zomby_dog
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 8

Expert Comment

by:ampapa
ID: 11868993
No, I believe you will have to loop through each row to retrieve the desired information. this should work but hasn't beentested.

For i = 1 to activesheet.usedrange.rows.count
    if ActiveSheet.Rows(i).Font.ColorIndex = 5 or ActiveSheet.Rows(i).Interior.ColorIndex = 5 then
    ....
    "do something"
    end if
next i
0
 
LVL 7

Accepted Solution

by:
_agj_ earned 125 total points
ID: 11869633
just a suggestion....not possible at the moment to verify it..

use the .Find function to search in the entire sheet.

the find function can be used to say, search in Formulas of a sheet. I think u shud be able to search in the Fonts/COlors.

use the range returned by find() to get the rows.

more when i check this up.
0
 
LVL 7

Expert Comment

by:_agj_
ID: 11889436
can u send me the code snippet u used finally?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question