Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Default Duplicate declaration in scope

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

Last edited by Hebs : January 10th 12 at 03:24 PM Reason: wrong code
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Duplicate declaration in scope

On Jan 10, 9:23*am, Hebs wrote:
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

--
Hebs


panname
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Duplicate declaration in scope

In message of Tue, 10 Jan 2012 15:23:25
in microsoft.public.excel.programming, Hebs
writes

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.
--
Walter Briscoe
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Workbook Declaration Varne Excel Discussion (Misc queries) 3 April 29th 08 09:49 AM
Macro / Compile Error / Duplicate Declaration carl Excel Worksheet Functions 1 June 29th 05 08:55 PM
which declaration to use Peer Excel Programming 3 August 2nd 04 03:17 PM
Declaration? TJF[_2_] Excel Programming 5 December 18th 03 03:26 PM
Variable Declaration?? Tom Ogilvy Excel Programming 1 August 8th 03 06:45 PM


All times are GMT +1. The time now is 05:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"