How to trigger a macro using a value that's in another tab in the same workbook

tommyboy1019

New Member
Joined
Aug 30, 2018
Messages
11
Hello all youVBA geniuses, Need some help with a doozy of a code here. I've got this pieceof script that hides rows in a tab called "Lab Tests_Plants". Youenter a number in cell D15 and it shows you the corresponding amount of rows.Cell E15 = "#" and E16 = "<=" to lay out parameters.

Private Sub worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Me.Range("D15:D15")) Is Nothing Then

Range("A14:AC28").AdvancedFilter Action:=xlFilterInPlace,CriteriaRange:=Range _
("E15:E16"), Unique:=False

What I need to do is enter this number on a different
tab called“LaborBudget” so that it will hide the rows on the sheet that the macro isin(Currently “Lab Tests_Plants”).


Forexample I enter 5 in cell D15 in the “Labor Budget” tab and 5 rows showin the “LabTests_Plants” tab.
Any advice or help is highly appreciated.

Thanks!


 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Untested, but try this in the Sheet code of "Labor Budget"
Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    If Not Intersect(Target, Cells(15, 4)) Is Nothing Then
        With sheets("Lab Tests_Planets")
            .Select
            .Cells(15, 4).Value = Target.Value
        End With
    End If
        
End Sub
 
Last edited:
Upvote 0
It didn't quite work. But thank you for your response. Although I see the logic behind the code, the macro seems to have corrupted the file. It could be because I'm using more than one macro on the same sheet. I type in 5 and nothing happens. When I go to the corresponding tab and type in a number the whole sheet freezes.
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,183
Members
452,615
Latest member
bogeys2birdies

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