I have a work book that was created with Excel 2003, but it no longer functions the way it was designed now that all of our computers were upgraded to Office 2007. The purpose of the work book is to keep track of daily munitions expenditures. Due to the strict permissions on government computers, I'm not allowed to change any of the trust center settings, so the easy fix of adding trusted sources/editors is no good.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o></o>
The basic idea for the work book is that the first tab holds all the data and then there are 31 tabs following that; one for each day of the month. The macro fills in the aircraft information into the day page when I enter the aircraft number into a cell. My problem is that the macro runs every single time the work book is opened, in all 31 day tabs instead of only activating when the information is requested. This causes problems, because I need to maintain a record of each day's expenditures for the whole month. I would like to have the macro function only when the aircraft number is inserted into the cell, and no other time.<o></o>
<o></o>
I'm hoping that someone might have a fairly simple solution, or know where I can go to learn how to make a work-a-round for this myself. I don't know very much about VBA, and I'm not even sure if what I'm asking for is possible.<o></o>
<o></o>
Below is the code that I need to modify. I feel like the solution should be fairly simple, but I don't understand much of anything after the Function FIndPart line. Any help would be greatly appreciated.<o></o>
<o></o>
<o></o>
<o></o>
<o> </o>
<o></o>
The basic idea for the work book is that the first tab holds all the data and then there are 31 tabs following that; one for each day of the month. The macro fills in the aircraft information into the day page when I enter the aircraft number into a cell. My problem is that the macro runs every single time the work book is opened, in all 31 day tabs instead of only activating when the information is requested. This causes problems, because I need to maintain a record of each day's expenditures for the whole month. I would like to have the macro function only when the aircraft number is inserted into the cell, and no other time.<o></o>
<o></o>
I'm hoping that someone might have a fairly simple solution, or know where I can go to learn how to make a work-a-round for this myself. I don't know very much about VBA, and I'm not even sure if what I'm asking for is possible.<o></o>
<o></o>
Below is the code that I need to modify. I feel like the solution should be fairly simple, but I don't understand much of anything after the Function FIndPart line. Any help would be greatly appreciated.<o></o>
<o></o>
<o></o>
Code:
<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]'This Function is the Main Lookup for the Entire Workbook. It Receives an Aircraft
'Number from the Calling Cell, and that Cells Column & Level in Relation to that Aircraft.
'The Function Searches the "Data" Sheet for the Aircraft, then Sends Back the Cell in
'Relation to the Calling Cell. If the Aircraft is Anything Other than an Actual Aircraft
'on the "Data" Sheet, it will Return Blank.<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Function FindPart(Jet, Column, Level) As Object
Dim LineNumber As Integer
Dim Found As Boolean
Found = False
If Jet > 0 Then
For XLoop = 5 To 157 '157 corresponds to the Number of rows on the Data Sheet
If Sheets("DATA").Cells(XLoop, 2).Value = Jet Then
Found = True
LineNumber = XLoop
XLoop = 157
Else
XLoop = XLoop + 3
End If
Next XLoop
If Found Then
Set FindPart = Sheets("DATA").Cells(LineNumber + Level, Column - 1)
End If
End If<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]If Not Found Then
Set FindPart = Sheets("DATA").Cells(1, 10)
End If<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]End Function<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]
<o> </o>