Run macro on one sheet from another

GeoThornton96

New Member
Joined
Jul 5, 2020
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello, I have a macro on one sheet (A1) that I would like to run on that sheet(A1) but to be activated from another sheet (Home) if that makes sense. This is the code that I want to run and is on (A1).

VBA Code:
Sub HANDSET()
'
' HANDSET Macro
' Macro recorded 04/07/2020 by GThornton
'

'
    Selection.AutoFilter Field:=4, Criteria1:="HANDSET"
End Sub

and then on another sheet(HOME), I have a macro that hides and shows shapes but I also want it to run the macro above. I do know how to do this. this is the code for that

VBA Code:
Public Sub TypeHandset()
 




    If ActiveSheet.Shapes("Rectangle 12").Visible Then
        ActiveSheet.Shapes("Rectangle 12").Visible = False
        ActiveSheet.Shapes("Rectangle 13").Visible = False
        ActiveSheet.Shapes("Rectangle 14").Visible = False
        ActiveSheet.Shapes("Rectangle 15").Visible = False
        ActiveSheet.Shapes("Rectangle 16").Visible = False
        ActiveSheet.Shapes("Rectangle 17").Visible = False
    Else
        ActiveSheet.Shapes("Rectangle 12").Visible = True
        ActiveSheet.Shapes("Rectangle 13").Visible = True
        
    End If
    

   
   

End Sub

I am very new to VBA so sorry if my code is terrible. I appreciate the help
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi,
Instead of activesheet you maybe use:

VBA Code:
Dim oSht as worksheet
Set oSht = Sheets("A1")
....
oSht.AutoFilter....
or
oSht.Shapes("Rectangle 12") ...
....
Set oSht = nothing
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,072
Latest member
DW Draft

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