I have a drop down menu for the user to select the week number they want to view. Once they select the week I want code to run that will hide all but the data from that week. I wrote the code and it works when I run it as a macro, but I don't know how to make it automatically run once the week number cell is changed. I don't want to have to tell people to select their choice from the drop down menu, and then run the macro manually. I'm sure there has to be a way to insert this code into the worksheet itself, but I am unsure as to how to write it, and where to put it. Many thanks for the help.

Here's my macro code if you're interested:

Sub hideall()
'
' hideall Macro
'


    
    Columns("G:HA").Select
   
   Selection.EntireColumn.Hidden = True
   
      If Range("B1").Value = "Week 26" Then
   Columns("T:AI").Select
   Selection.EntireColumn.Hidden = False
   
      ElseIf Range("B1").Value = "Week 27" Then
    Columns("AJ:AY").Select
   Selection.EntireColumn.Hidden = False
   
      ElseIf Range("B1").Value = "Week 28" Then
    Columns("AZ:BO").Select
   Selection.EntireColumn.Hidden = False
   
      ElseIf Range("B1").Value = "Week 29" Then
    Columns("BP:CE").Select
   Selection.EntireColumn.Hidden = False
   
      ElseIf Range("B1").Value = "Week 30" Then
    Columns("CF:CU").Select
   Selection.EntireColumn.Hidden = False
   
      ElseIf Range("B1").Value = "Week 31" Then
    Columns("CV:DK").Select
   Selection.EntireColumn.Hidden = False
   
      ElseIf Range("B1").Value = "Week 32" Then
    Columns("DL:EA").Select
   Selection.EntireColumn.Hidden = False
   
      ElseIf Range("B1").Value = "Week 33" Then
    Columns("EB:EQ").Select
   Selection.EntireColumn.Hidden = False
   
      ElseIf Range("B1").Value = "Week 34" Then
    Columns("ER:FE").Select
   Selection.EntireColumn.Hidden = False
   
      ElseIf Range("B1").Value = "Week 35" Then
    Columns("FH:FW").Select
   Selection.EntireColumn.Hidden = False
   
   ElseIf Range("B1").Value = "Week 36" Then
    Columns("FX:GM").Select
   Selection.EntireColumn.Hidden = False
   
      ElseIf Range("B1").Value = "Week 37" Then
    Columns("GN:HC").Select
   Selection.EntireColumn.Hidden = False
   
   
   End If
   
End Sub
btw, if it matters, the cell with the drop down menu for week number is cell B1