Macro/Formula to Select Rows of data and output to new Worksheets(?)

HoustonREFinance

New Member
Joined
Jan 16, 2015
Messages
10
Hello, I am using excel 2007.

I am working with a project whereby I am trying to understand how to create a form button macro that will select the applicable rows of data that is particular to a Project (my input worksheets contains multiple 'projects', like below, Projects 1, 2, 3, etc., so I'd probably need a button for each project, or maybe one button could handle all Projects (?), and then 'Output '(copy, paste, link, etc.) the applicable rows (where the "Include?" Column =1, 0 to exclude) into a new worksheet. That may be straightforward enough, but I do have a second condition/issue that you might have some advice upon. Example below:

My Inputs Worksheet (User inputs are in Blue)
1111 2222
Include?Project 1 Include?2
1Title Hotel 1Apartments
1ID H 0A
0 Variable 1Variable 2 0Variable 1Variable 2
1Budget ItemTotalAmountTotal Amount
1Land 1
1Purchase 20,000$20.00 $400,000 130,000$20.00 $600,000
0Closing Cost 0.00% $0 13.00% $18,000
1Total (#2) $400,000 1 $618,000
1 1
0Shared Costs 0
1Roads 20,000$10.00 $200,000 00$0.00 $0
1Total (#2) $200,000 1 $0
1
1Building Cost 1
1Tower 150,000$300.00 $45,000,000 1150,000$125.00 $18,750,000
1Parking 350$15,000 $5,250,000 1300$10,000 $3,000,000
1Total (#3) $50,250,000 $21,750,000

<colgroup><col span="3"><col><col><col><col><col span="2"><col><col><col span="2"></colgroup><tbody>
</tbody>

So the 'Output' worksheet from the macro function would result in a separate worksheets for Project 1 and Project 2. I can see two macro form buttons on this page, that basically select the columns in the first row that are equal to the Project 1, or 2, etc, and then select the rows that Include the variable "1" along the left side of each project entry page.

The Output worksheets could just copy everything, ignoring the "include" condition, but I'd just need a follow up function that would group and collapse, or 'hide' the rows that do not have applicable data on the Output Worksheet for Print Report purposes (which could be a separate form button macro question on its own). That would be fine as well.

The second condition is that the Output sheets would be integrated into another set of worksheets that each perform calculations based on the values in the Inputs worksheets. So those worksheets would need to be able to identify and 'link' to the appropriate values so as not to create the #Ref error. So for instance, for Project 1, the Output worksheet would be integrated into a series of four other worksheets, where by they would be trying to reference the values associated with Total #1, Total #2 and Total #3. I am not that familiar with Named Ranges, but I sense this would be cumbersome since I'll have so many projects referencing the same Totals, but within their separate "Project" worksheets.

I know this is a long question, and may be answered in a couple of different parts, but any help would be appreciated! (as my current process for integrating these into these different projects is very time consuming and I know very inefficient!)

Thanks,
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
I started working on an idea of achieving this but didn't get very far and ran out of free time
Hopefully this helps you or the next person who tries to write something though!

Best of luck

Code:
Sub project_example()
        
    Dim FindString As String
    Dim Rng As Range
    Dim WS As Worksheet
    
    FindString = InputBox(Prompt:="What is the name of the Project?", _
        Title:="PROJECT NAME", Default:="Project Name here")
    If Trim(FindString) <> "" Then
        With Sheets("Sheet1").Range("A1:Z100")
            Set Rng = .Find(What:=FindString, _
                            After:=.Cells(.Cells.Count), _
                            LookIn:=xlValues, _
                            LookAt:=xlWhole, _
                            SearchOrder:=xlByRows, _
                            SearchDirection:=xlNext, _
                            MatchCase:=False)
            If Not Rng Is Nothing Then
                WS.Name = FindString
                Set WS = Sheets.Add(After:=Sheets(Worksheets.Count))
                'ran out of time to write anything to select the data,
                'it shouldnt be too hard to do based on the FindString location though
            Else
                MsgBox "Project Not Found."
            End If
        End With
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,586
Messages
6,125,686
Members
449,249
Latest member
ExcelMA

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