View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default Excel 2002 Startup Macro

After opening the VB Editor double click on the item called "thisWorkbook".
in the window that opens place the following:

Private Sub Workbook_Open()
Application.ScreenUpdating = False
Workbooks.Open FileName:="NameMaster" 'Make sure to include the full path
Sheets("mySheet").Range("A1:A100").Copy
Workbooks("_PayrollSheet").Sheets("thisSheet").Ran ge("A1").PasteSpecial _
Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.cutcopymode = false
Workbooks("NameMaster").Activate
ActiveWorkbook.Close False 'closes "NameMaster" without saving

Msgbox "The file has been updated", vbInformation
End Sub

Make sure you change the ranges and sheet names to fit your needs.

"Carl" wrote:

I am trying to create a simple macro that will run every time I open a
specific workbook in Excel 2002. When I look at the Excel helpfile on this
it tells me to start the Visual Basic Editor and search for help there. I do
that but find no help on this subject at all.

All I want to do is copy a long list of names from one workbook
("NameMaster" to another ("_PayrollSheet") for a validation list. I will
then copy the NameList to an area just below my data entry block to take
advantage of autofill.

I want to use the macro because the "NameMaster" workbook will change
frequently and I need the current list in the _PayrollSheet "NameList" every
time that workbook is opened.

Thanks for the help,
Carl