Duplicate declaration in scope

H

Hebs

I am having troubles with this code please help.
its giving me the duplicate declaration in scope error.

Sub EnterSave(PanSize, PanName, CartNum, Dwidth, ProdName)
Dim Jobnum As Long
Dim DoorNum As Long
Dim PanName As Long
Jobnum = CartForm.JobTxt.Value
NumDoor = CartForm.NumDoorTxt.Value
DoorNum = CartForm.DoorTxt.Value
Sheets("Carts").Visible = True
Sheets("Carts").Select

Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = Jobnum
ActiveCell.Offset(0, 1).Value = NumDoor
ActiveCell.Offset(0, 2).Value = DoorNum
ActiveCell.Offset(0, 3).Value = PanName
ActiveCell.Offset(0, 4).Value = CartNum
ActiveCell.Offset(0, 5).Value = Dwidth
ActiveCell.Offset(0, 6).Value = PanSize
ActiveCell.Offset(0, 7).Value = ProdName

End Sub

Thanks in advanc
 
D

Don Guillett

I am having troubles with this code please help.
its giving me the duplicate declaration in scope error.

Sub EnterSave(PanSize, PanName, CartNum, Dwidth, ProdName)
Dim Jobnum As Long
Dim DoorNum As Long
Dim PanName As Long
Jobnum = CartForm.JobTxt.Value
NumDoor = CartForm.NumDoorTxt.Value
DoorNum = CartForm.DoorTxt.Value
Sheets("Carts").Visible = True
Sheets("Carts").Select

Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = Jobnum
ActiveCell.Offset(0, 1).Value = NumDoor
ActiveCell.Offset(0, 2).Value = DoorNum
ActiveCell.Offset(0, 3).Value = PanName
ActiveCell.Offset(0, 4).Value = CartNum
ActiveCell.Offset(0, 5).Value = Dwidth
ActiveCell.Offset(0, 6).Value = PanSize
ActiveCell.Offset(0, 7).Value = ProdName

End Sub

Thanks in advance

panname
 
W

Walter Briscoe

In message <[email protected]> of Tue, 10 Jan 2012 15:23:25
in microsoft.public.excel.programming, Hebs
I am having troubles with this code please help.
its giving me the duplicate declaration in scope error.

Sub EnterSave(PanSize, PanName, CartNum, Dwidth, ProdName)
Dim Jobnum As Long
Dim DoorNum As Long
Dim PanName As Long
Jobnum = CartForm.JobTxt.Value

PanName is both a parameter of EnterSave and a variable within it.
That is why the code gets a duplicate declaration.
I believe PanSize is equivalent to Byref PanSize as Variant.
Is that what is intended?
What is CartForm?
There are good reasons to start all code with Option Explicit

A stand alone example might cause the answer to leap out.
That would save the effort of waiting for an answer.
 

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

Top