Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ran into a problem when running this macro 1

Status
Not open for further replies.

YNOTU

Technical User
Jun 21, 2002
749
US
[code>
Private Sub Workbook_Open()
If [C1].Value <> "" And [C2].Value <> "" And [K2].Value <> "" And [I5].Value <> "" And [I6].Value <> "" Then Exit Sub
Dim Client As String, Desc As String, Job As String, AccountManager As String, Programmer As String, ProductSize As String
Client = Application.InputBox(Prompt, "Client Name :")
Desc = Application.InputBox(Prompt, "Job Description :")
Job = Application.InputBox(Prompt, "Job Number :")
AccountManager = Application.InputBox(Prompt, "Account Manager :")
Programmer = Application.InputBox(Prompt, "Programmer :")
ProductSize = Application.InputBox(Prompt, "Product Size :")
Range("C1").Value = Client
Range("C2").Value = Desc
Range("K2").Value = Job
Range("I5").Value = AccountManager
Range("I6").Value = Programmer
Range("J10").Value = ProductSize

End Sub[/code]

I've used this code for a long time on an excel sheet without any problems Until now. I have added two more sheets to the form and when users save the documents on sheet 3 the macro does not run correctly.

I was wondering if I could force the workbook to begin at page 1 before the macro begins.

Thank you very much in advanced all...

I'll put something here when I think of it...
 
Code:
Private Sub Workbook_Open()
If [C1].Value <> "" And [C2].Value <> "" And [K2].Value <> "" And [I5].Value <> "" And [I6].Value <> "" Then Exit Sub
Dim Client As String, Desc As String, Job As String, AccountManager As String, Programmer As String, ProductSize As String
Client = Application.InputBox(Prompt, "Client Name :")
Desc = Application.InputBox(Prompt, "Job Description :")
Job = Application.InputBox(Prompt, "Job Number :")
AccountManager = Application.InputBox(Prompt, "Account Manager :")
Programmer = Application.InputBox(Prompt, "Programmer :")
ProductSize = Application.InputBox(Prompt, "Product Size :")
Range("C1").Value = Client
Range("C2").Value = Desc
Range("K2").Value = Job
Range("I5").Value = AccountManager
Range("I6").Value = Programmer
Range("J10").Value = ProductSize

End Sub
 
Private Sub Workbook_Open()
sheets("Whateversheetnameyouwanttobeactive").activate

...etc etc

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Thank you very much xlbo as always
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top