I'm getting a 424 "Object Required" when calling a vba function. The function parameter requires a range to change the name of the worksheet tab to be the same as a cell value.
Here is the code:
Dim new_wb As Workbook
Dim act_wb As Workbook
Dim stu_name As Object
Dim lastRow As Long
Dim currCol As Long
Dim nameRange As Range
Set act_wb = ActiveWorkbook
currCol = ActiveCell.Column
lastRow = Cells(Rows.Count, 1).End(xlUp).Row
Set nameRange = Worksheets(1).Range("A4")
'begin vba code
ActiveWorkbook.Sheets(1).copy
Worksheet_Change (nameRange) 'error occurs here.
Here is the function signature of the function being called:
Private Sub Worksheet_Change(ByVal Target As Range)
If I remove the 'Set' keyword for nameRange, I get the following error

Worksheet_Change (nameRange)toWorksheet_Change nameRangeThis will take care of the error but why do you want to call the worksheet event like this?What's your suggestion for calling a worksheet event like this?Put it in the relevant sheet code module and WAIT for the event to automaticlly execute :D. I think you need to read about worksheet events and what are they for.Worksheet_Changeevent to detect when the user edited the contents of one of those cells to update the name of its corresponding sheet automatically.