+ Reply to Thread
Results 1 to 2 of 2

List Cells with specific value

  1. #1
    Registered User
    Join Date
    08-28-2006
    Posts
    1

    List Cells with specific value

    Here's what I was hoping you could help me with:

    I have 4 Sheets: Header Sheet, Sheet1, Sheet2, Sheet3, Sheet 4.
    I was hoping I could get help with a macro that would make a list on the header sheet starting in cell A5 down listing all the cells with A1 type labels that contain a value of "--" on each sheet. In A5 it would say "Sheet 1:" and below it it would list the cells in range B10-F20 on Sheet 1 that have "--" as a value. Then after all of those the next row would say "Sheet 2:" and list the cells in whatever range I set in the code that have "--" values. Can anyone help me?

    I'm using this to alert me when there are empty pulls from thomson analytics, so any help you can give me will help me keep my work quality up to par!

  2. #2
    Valued Forum Contributor
    Join Date
    12-16-2004
    Location
    Canada, Quebec
    Posts
    363
    Hi

    Would this help
    Sub listcell()
    Dim Cell As Range
    Dim usedrng As Range
    On Error Resume Next
    For i = 1 To 4
    Sheets("Sheet" & i).Select
    determineusedrange usedrng
    For Each Cell In usedrng
    If Cell.Value = "--" Then

    addr = Cell.Address
    Sheets("Sheet").Select
    rowcount = Cells(Cells.Rows.Count, "a").End(xlUp).Row
    Range("a" & rowcount + 1).Select
    ActiveCell.Value = "Sheet" & i
    ActiveCell.Offset(0, 1).Select
    ActiveCell.Value = addr

    Sheets("Sheet" & i).Select
    End If
    Next Cell
    Next
    End Sub

    Sub determineusedrange(ByRef theRng As Range)
    Dim FirstRow As Integer, FirstCol As Integer
    Dim LastRow As Integer, LastCol As Integer
    On Error GoTo handleerror
    FirstRow = Cells.Find(what:="*", searchdirection:=xlNext, searchorder:=xlByRows).Row
    FirstCol = Cells.Find(what:="*", searchdirection:=xlNext, searchorder:=xlByColumns).Column
    LastRow = Cells.Find(what:="*", searchdirection:=xlPrevious, searchorder:=xlByRows).Row
    LastCol = Cells.Find(what:="*", searchdirection:=xlPrevious, searchorder:=xlByColumns).Column
    Set theRng = Range(Cells(FirstRow, FirstCol), Cells(LastRow, LastCol))
    handleerror:
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1