?
Solved

Using VBA to search for cell attributes in Excel

Posted on 2014-04-24
1
Medium Priority
?
343 Views
Last Modified: 2014-04-25
Hi,

I'm just learning VBA for Excel 2010 and am faced with looking for cells in a table which have a certain characteristic.  In this case, a percentage format applied.  Haven't seen an obvious way so far to search for this type of characteristic.

Suggestions?

Thanks!

--Ben
0
Comment
Question by:Ben Conner
1 Comment
 
LVL 54

Accepted Solution

by:
Rgonzo1971 earned 2000 total points
ID: 40021901
Hi,

pls try

Sub Macro()
Set myRange = ActiveSheet.UsedRange
Application.FindFormat.NumberFormat = "0.00%"

Set Result = myRange.Find(what:="", searchformat:=True)
    If Not Result Is Nothing Then
        strFirstAddress = Result.Address
        Do
            lCount = lCount + 1
            Set Result = myRange.Find(what:="", after:=Result, searchformat:=True)
        Loop While Not Result Is Nothing And Result.Address <> strFirstAddress
        MsgBox lCount & " Found", vbInformation
    Else
        MsgBox "None Found", vbExclamation
    End If
End Sub

Open in new window

Regards
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

809 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