LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Add-in Question (common code)

I have 10 Workbooks that all have identical Modules and VB code functions.

I want to centralize that code in one place so that fixes don't have to be
made 10 times. I created an Add-in with a Module containing all of the
common code. The problem now is that this common code refences the worksheet
cells (which don't exist in the Addin) as ThisWorkbook. I want it to
reference what ever workbook was opened. How do I do this?

So for example the code in the Addin Module1 has:

Set wsh = ThisWorkbook.Sheets("DW")
ThisWorkbook.Sheets("DW").Activate
'Assumes data starts in column D
Set rRng = wsh.Range("D11", "AY11")

On Error GoTo Err_Handle

sContractCode = Worksheets("DW").Range("D5").Value
dStartDate = Worksheets("DW").Range("D7").Value

etc.,etc...


 
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
Common footer but not common margins please -(Page 1 of 2) etc RajenRajput1 Excel Discussion (Misc queries) 9 August 26th 08 06:56 PM
Using common VBA code for a series of Woorkbooks. Martin Sørerensen Excel Programming 4 March 2nd 06 11:06 AM
Perform code on all (closed) workbooks scattered across sub-folders of common parent folder ikr[_2_] Excel Programming 6 February 21st 06 08:08 AM
If I have two reoated data-sets and a common code, how can I get i helixed Excel Worksheet Functions 1 January 18th 06 03:55 AM
dynamic range reference and use of common code clui[_4_] Excel Programming 2 December 2nd 03 05:45 PM


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

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"