Solved

Getting data from Excel

Posted on 2004-08-23
3
157 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
  • 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now