Solved

Using VBA to search for cell attributes in Excel

Posted on 2014-04-24
1
325 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 48

Accepted Solution

by:
Rgonzo1971 earned 500 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

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

Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose 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

11 Experts available now in Live!

Get 1:1 Help Now