LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Declaring variables for use in a Module

Is there a way to declare these statement within a Module so that I don't
have to do it in every Subroutine in the Module?

Set errorWS = Worksheets("Error_MarketList")
Set bulkuploadWS = Worksheets("Bulkupload Result")

Right now I have this:

Private Sub cmdbuildBulkUpload_Click()
Set errorWS = Worksheets("Error_MarketList")
errorWS_lastRow = errorWS.Cells(Rows.Count, "A").End(xlUp).Row

Private Sub cmdupdateDates_Click()
Set errorWS = Worksheets("Error_MarketList")
errorWS_lastRow = errorWS.Cells(Rows.Count, "A").End(xlUp).Row

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Set siteWS = Worksheets("Site Milestone Dates")
Set errorWS = Worksheets("Error_MarketList")
errorWS_lastRow = errorWS.Cells(Rows.Count, "A").End(xlUp).Row

Private Sub cmdupdateMarketlist_Click()
Set updateWS = Worksheets("Updated_MarketList")
Set errorWS = Worksheets("Error_MarketList")
errorWS_lastRow = errorWS.Cells(Rows.Count, "A").End(xlUp).Row
updateWS_lastRow = updateWS.Cells(Rows.Count, "A").End(xlUp).Row - 2

Sub changeMarketList()
Set errorWS = Worksheets("Error_MarketList")
Set updateWS = Worksheets("Updated_MarketList")

Sub build_BulkUpload(Sdate As String, Sstatus As String, cRow As Integer)
Dim siteRow As Long
Dim bulkuploadWS As Worksheet, errorWS As Worksheet
Set errorWS = Worksheets("Error_MarketList")
Set bulkuploadWS = Worksheets("Bulkupload Result")

 
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
Declaring variables in Module vs. Public Jeff Excel Discussion (Misc queries) 5 November 19th 07 08:27 PM
Declaring variables Mike Excel Programming 4 November 28th 05 07:05 PM
Declaring Variables Brad Excel Programming 3 May 12th 04 08:13 PM
Declaring variables Pedro Excel Programming 1 November 13th 03 03:32 PM
Declaring Variables chris brunt Excel Programming 2 August 4th 03 02:02 PM


All times are GMT +1. The time now is 03:25 AM.

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

About Us

"It's about Microsoft Excel"