Finding input cells in a large excel model

bjorn007

New Member
Joined
Aug 5, 2005
Messages
6
Hello,

I am trying to create a macro that searches through an excel file and returns input cells (cells that do not depend on other cells - i.e. the last cells when using the Precendent function). My excel file has several excel sheets.

This is way above my Excel and VBA knowlegde, so do hope someone have a formula or have some advice for solving this. Been searching the internet for an good answer, but haven't managed to find anything that is working.

Have a good day.

Bjørn
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Bjorn, depending on how many non-contiguous ranges you have on each sheet being referenced you might get away with something along the lines of the below ?

Code:
Sub Example()
Dim ws As Worksheet
If Not Evaluate("ISREF(PRIMEMOVERS!A1)") Then Sheets.Add(Before:=Sheets(1)).Name = "PRIMEMOVERS"
With Sheets("PRIMEMOVERS")
    .Range(.Cells(2, "A"), .Cells(Rows.Count, "A").End(xlUp).Offset(, .Columns.Count - 1)).Clear
    .Cells(1).Resize(, 2).Value = Array("Sheet", "Address")
    For Each ws In ThisWorkbook.Worksheets
        If UCase(ws.Name) <> "PRIMEMOVERS" Then
            With .Cells(.Rows.Count, "A").End(xlUp).Offset(1).Resize(, 2)
                .Cells(1).Value = ws.Name
                .Cells(2).Value = ws.Cells.SpecialCells(xlCellTypeConstants).Address
            End With
        End If
    Next ws
End With
End Sub

The above would add a sheet (if it didn't exist) which would list by sheet all constants in use.
Of course this would not pick up blanks if they were "prime movers" (ie first precedent) - unclear if this is an issue or not.
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,591
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top