Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 361
Default Excel 2002 Startup Macro

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
  #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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 152
Default Excel 2002 Startup Macro



"JNW" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 152
Default Excel 2002 Startup Macro

Private Sub Workbook_Open()
' INSERT_DESCRIPTION_HERE Macro
Application.ScreenUpdating = False
ActiveSheet.Unprotect
Workbooks.Open FileName:="\YOUR_MASTER" ' Include full path
Range("A1:A100").Select
Selection.Copy
ActiveWindow.ActivateNext
Range("A1").Select
ActiveSheet.Paste
ActiveWindow.ActivatePrevious
Application.CutCopyMode = False
ActiveWindow.Close
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub

You may need to play with this slightly but I think you'll find it easier to
use. If your sheets aren't protected delete the protect and unprotect lines.
If you prefer include the message box from JNW
Lou

"JNW" wrote:

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 361
Default Excel 2002 Startup Macro

Thank you both for the help and tips...I'll try this tomorrow but it sure
looks good to me.

Carl

"Rookie 1st class" wrote:

Private Sub Workbook_Open()
' INSERT_DESCRIPTION_HERE Macro
Application.ScreenUpdating = False
ActiveSheet.Unprotect
Workbooks.Open FileName:="\YOUR_MASTER" ' Include full path
Range("A1:A100").Select
Selection.Copy
ActiveWindow.ActivateNext
Range("A1").Select
ActiveSheet.Paste
ActiveWindow.ActivatePrevious
Application.CutCopyMode = False
ActiveWindow.Close
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub

You may need to play with this slightly but I think you'll find it easier to
use. If your sheets aren't protected delete the protect and unprotect lines.
If you prefer include the message box from JNW
Lou

"JNW" wrote:

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

Reply
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
Macro Help for Excel 2002 Somewhere In Excel 2002 Excel Discussion (Misc queries) 0 August 26th 07 01:20 AM
How to execute a macro automatically at startup of Excel? Radim Excel Programming 9 June 29th 06 11:55 AM
Excel 2002 and VB Macro adavisRSC Excel Programming 1 May 10th 05 04:09 PM
Excel 2002 and startup Glyn Davies Excel Programming 1 February 5th 04 05:08 PM
Automatic startup of an excel macro Quist Excel Programming 3 October 3rd 03 04:31 PM


All times are GMT +1. The time now is 10:17 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"