Solved

Using VBA to search for cell attributes in Excel

Posted on 2014-04-24
1
328 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 49

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Getting error in connectionstring with Excel. 30 32
VBA copy column paste as value 5 21
sort column using vba 2 19
Data Copy 4 24
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

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