Solved

Using VBA to search for cell attributes in Excel

Posted on 2014-04-24
1
333 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
[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
1 Comment
 
LVL 51

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

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…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

739 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