Help changing one line on a macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In VBE I have change the properties of name of the
sheetxx (Agent_information)
to
shtAgent (Agent_information)

and I would like to change the following Macro

Sub change_agent()
Sheets("Agent_information").Visible = True
ActiveWorkbook.Worksheets("Agent_information").Select
End Sub

to

Sub change_agent()
shtAgent.Visible = True
ActiveWorkbook.shtAgent.Name.Select
End Sub

If have tried several different command for the
Activeworkbook..... line

But none have worked - what is the correct syntax?

Thanks
 
Sub change_agent()
shtAgent.Visible = True
shtAgent.Select
End Sub

You don't need the activeworkbook line.
 
Refering to the objects directly takes a bit of getting used to...

Sub change_agent()
shtAgent.Visible = True
shtAgent.Select
End Sub
 
Thanks to both of you. I'm getting it

Jim Thomlinson said:
Refering to the objects directly takes a bit of getting used to...

Sub change_agent()
shtAgent.Visible = True
shtAgent.Select
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top