Click here to Skip to main content
15,921,062 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralFinding Available DB2 Servers Pin
Bob Bonser7-Dec-07 14:25
Bob Bonser7-Dec-07 14:25 
Generaladding multiple textboxes at runtime Pin
craigmg787-Dec-07 10:32
craigmg787-Dec-07 10:32 
GeneralRe: adding multiple textboxes at runtime Pin
Christian Graus7-Dec-07 10:51
protectorChristian Graus7-Dec-07 10:51 
GeneralRe: adding multiple textboxes at runtime Pin
craigmg787-Dec-07 10:57
craigmg787-Dec-07 10:57 
GeneralRe: adding multiple textboxes at runtime Pin
nlarson117-Dec-07 10:52
nlarson117-Dec-07 10:52 
QuestionWhat is the best way to write the same VBA code for multiple Excel workbooks? [modified] Pin
redjoy7-Dec-07 9:19
redjoy7-Dec-07 9:19 
GeneralRe: What is the best way to write the same VBA code for multiple Excel workbooks? Pin
Dave Kreskowiak8-Dec-07 17:04
mveDave Kreskowiak8-Dec-07 17:04 
GeneralRe: What is the best way to write the same VBA code for multiple Excel workbooks? [modified] Pin
redjoy9-Dec-07 10:26
redjoy9-Dec-07 10:26 
First of all thanks for your reply. I am new to add-ins and VSTO.
I only wrote the code behind the worksheets for my personal testing needs but my boss saw this and wants everyone to use this format. Hence the 15+ extra workbooks. I am now trying to re-write my code more efficiently (on my own time) as to make maintenance easier on me (and hopefully my test successors).

Dave Kreskowiak wrote:
I think you're taking the wrong approach. If the code needs to work with data from other files, it's the data that needs to be brought to the code, not the code to the data. Your code should be in one spot, and have the ability to use data from any workbook that you chose.


The code does not need to work with data from other files. All the data needed is already contained within each workbook.

Dave Kreskowiak wrote:

redjoy wrote:
2. Would an Excel add-in be appropriate?

That depends on what your code is doing and what your business process dictates.


The format of each Workbook is the same. The code for each workbook is identical.

I use my workbook for analysis purpose and generate a report for each of my workbooks (CSCI).

I execute some code based of values in various columns for each row in worksheet 7.

unique to each workbook:
Columns A-D are used for showing my requirements, test cases and test conditions.

The same in each workbook:
Columns E and F are used to show the status of completeness and performance of current requirement.
Column G shows the platform the current test case runs on (A, B, Both).
Columns H and I shows the test result (P, F, N/A) for platform A chosen in G.
Columns J and K shows the test result (P, F, N/A) for platform B chosen in G.
Columns I-P: not important to code.

Code behind Worksheet 7

for example (pseudo code):
Sub Worksheet_Changed(target as range) 'changes the color coding of active row based on columns E through K.
  if a2<>""then
    if e2="Complete" and f3="Met" then set the background colors of a2:p2 to GREEN.
      ...code for color RED.
      ...code for color YELLOW.
    else color WHITE.
    end if
  else
    if g3 = "A" and h3="P" and i3="P" then set the background colors of b3:i3 to GREEN.
      ... code for color RED.
    else color WHITE.
    end if
  end if


Code behind worksheet 8 copies portions of worksheet 7 to worksheet 2 and 6 and updates a database with the content of worksheet 7.

So right now when I improve/modify one workbook, I must copy the code to the other workbooks.

I was not able to find out any thing about add-ins using the VBA behind a worksheet. However, I will explore the websites you mentioned in your reply.

I hope this post makes sense.

Michael

If we knew what it was we were doing, it would not be called research, would it? --Albert Einstein


GeneralRe: What is the best way to write the same VBA code for multiple Excel workbooks? Pin
Dave Kreskowiak10-Dec-07 2:02
mveDave Kreskowiak10-Dec-07 2:02 
GeneralRe: What is the best way to write the same VBA code for multiple Excel workbooks? Pin
hwahlberg10-Feb-08 10:24
hwahlberg10-Feb-08 10:24 
GeneralCreate log file Pin
nishkarsh_k7-Dec-07 6:38
nishkarsh_k7-Dec-07 6:38 
GeneralRe: Create log file Pin
nlarson117-Dec-07 8:33
nlarson117-Dec-07 8:33 
GeneralRe: Create log file Pin
Mark Churchill7-Dec-07 14:44
Mark Churchill7-Dec-07 14:44 
GeneralSigning a User Control Pin
Andy Dale7-Dec-07 3:39
Andy Dale7-Dec-07 3:39 
GeneralPassword Problem Pin
Dave McCool7-Dec-07 2:21
Dave McCool7-Dec-07 2:21 
GeneralRe: Password Problem Pin
Christian Graus7-Dec-07 10:53
protectorChristian Graus7-Dec-07 10:53 
GeneralRe: Password Problem Pin
Dave McCool8-Dec-07 1:37
Dave McCool8-Dec-07 1:37 
GeneralEnding a VB Program Pin
Dreamer20077-Dec-07 1:11
Dreamer20077-Dec-07 1:11 
GeneralRe: Ending a VB Program Pin
CPallini7-Dec-07 2:19
mveCPallini7-Dec-07 2:19 
QuestionURGENT: Export to excel and special characters Pin
buzzvishwanath6-Dec-07 22:47
buzzvishwanath6-Dec-07 22:47 
GeneralRe: URGENT: Export to excel and special characters Pin
coolestCoder7-Dec-07 4:40
coolestCoder7-Dec-07 4:40 
GeneralRe: URGENT: Export to excel and special characters Pin
leckey7-Dec-07 8:03
leckey7-Dec-07 8:03 
GeneralRe: URGENT: Export to excel and special characters Pin
Paul Conrad7-Dec-07 14:43
professionalPaul Conrad7-Dec-07 14:43 
GeneralUser defined DataTypes Pin
gilchinger6-Dec-07 21:21
gilchinger6-Dec-07 21:21 
GeneralRe: User defined DataTypes Pin
gilchinger7-Dec-07 1:14
gilchinger7-Dec-07 1:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.