Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Opening a Workbook with a Macro

I currently have a Macro that will copy data from another workbook into my
current workbook but I have to have the second one open for this to work. I
would like to change this so I do not have to manually open the second
workbook. I want to be able to press my shortcut key and have the second
workbook open, copy the data, paste it in my current workbook, and close the
second workbook. Here is the Macro that I currently have:

Windows("Blkacc223508.xls").Activate
Worksheets("Total-1").Select
Range("C3:N14").Select
Selection.Copy
Windows("2008 worksheets.xls").Activate
Range("B59").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=True
Range("A72").Select
End Sub

Thanks in advance for your help.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default Opening a Workbook with a Macro

Eli,

If you are certain it will be closed, change:

Windows("Blkacc223508.xls").Activate


to

Workbooks.Open "Blkacc223508.xls"

Though you have need to add the path in there as well, such as

Workbooks.Open "C:\Excel Files\Blkacc223508.xls"

HTH,
Bernie
MS Excel MVP



"Eli" wrote in message
...
I currently have a Macro that will copy data from another workbook into my
current workbook but I have to have the second one open for this to work.
I
would like to change this so I do not have to manually open the second
workbook. I want to be able to press my shortcut key and have the second
workbook open, copy the data, paste it in my current workbook, and close
the
second workbook. Here is the Macro that I currently have:

Windows("Blkacc223508.xls").Activate
Worksheets("Total-1").Select
Range("C3:N14").Select
Selection.Copy
Windows("2008 worksheets.xls").Activate
Range("B59").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=True
Range("A72").Select
End Sub

Thanks in advance for your help.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Opening a Workbook with a Macro

Bernie,

Thank you that works perfectly. I have one other small glitch. When the
second workbook opens, it is linked to still another workbook and thus it
puts up a dialog box asking me if I want to Update or Dont Update which
stops the script. Is there a way to tell it Dont Update automatically?

"Bernie Deitrick" wrote:

Eli,

If you are certain it will be closed, change:

Windows("Blkacc223508.xls").Activate


to

Workbooks.Open "Blkacc223508.xls"

Though you have need to add the path in there as well, such as

Workbooks.Open "C:\Excel Files\Blkacc223508.xls"

HTH,
Bernie
MS Excel MVP



"Eli" wrote in message
...
I currently have a Macro that will copy data from another workbook into my
current workbook but I have to have the second one open for this to work.
I
would like to change this so I do not have to manually open the second
workbook. I want to be able to press my shortcut key and have the second
workbook open, copy the data, paste it in my current workbook, and close
the
second workbook. Here is the Macro that I currently have:

Windows("Blkacc223508.xls").Activate
Worksheets("Total-1").Select
Range("C3:N14").Select
Selection.Copy
Windows("2008 worksheets.xls").Activate
Range("B59").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=True
Range("A72").Select
End Sub

Thanks in advance for your help.




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default Opening a Workbook with a Macro

Eli,

Try using

Application.DisplayAlerts = False

just before you open the workbook.

HTH,
Bernie
MS Excel MVP


"Eli" wrote in message
...
Bernie,

Thank you that works perfectly. I have one other small glitch. When the
second workbook opens, it is linked to still another workbook and thus it
puts up a dialog box asking me if I want to Update or Don't Update which
stops the script. Is there a way to tell it Don't Update automatically?

"Bernie Deitrick" wrote:

Eli,

If you are certain it will be closed, change:

Windows("Blkacc223508.xls").Activate


to

Workbooks.Open "Blkacc223508.xls"

Though you have need to add the path in there as well, such as

Workbooks.Open "C:\Excel Files\Blkacc223508.xls"

HTH,
Bernie
MS Excel MVP



"Eli" wrote in message
...
I currently have a Macro that will copy data from another workbook into
my
current workbook but I have to have the second one open for this to
work.
I
would like to change this so I do not have to manually open the second
workbook. I want to be able to press my shortcut key and have the
second
workbook open, copy the data, paste it in my current workbook, and
close
the
second workbook. Here is the Macro that I currently have:

Windows("Blkacc223508.xls").Activate
Worksheets("Total-1").Select
Range("C3:N14").Select
Selection.Copy
Windows("2008 worksheets.xls").Activate
Range("B59").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=True
Range("A72").Select
End Sub

Thanks in advance for your help.






  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default Opening a Workbook with a Macro

Eli,

Workbooks.Open "Blkacc223508.xls", True

to auto update the links:

Workbooks.Open "Blkacc223508.xls", False

to not update.

Bernie


"Eli" wrote in message
...
Bernie,

Thank you that works perfectly. I have one other small glitch. When the
second workbook opens, it is linked to still another workbook and thus it
puts up a dialog box asking me if I want to Update or Don't Update which
stops the script. Is there a way to tell it Don't Update automatically?

"Bernie Deitrick" wrote:

Eli,

If you are certain it will be closed, change:

Windows("Blkacc223508.xls").Activate


to

Workbooks.Open "Blkacc223508.xls"

Though you have need to add the path in there as well, such as

Workbooks.Open "C:\Excel Files\Blkacc223508.xls"

HTH,
Bernie
MS Excel MVP



"Eli" wrote in message
...
I currently have a Macro that will copy data from another workbook into
my
current workbook but I have to have the second one open for this to
work.
I
would like to change this so I do not have to manually open the second
workbook. I want to be able to press my shortcut key and have the
second
workbook open, copy the data, paste it in my current workbook, and
close
the
second workbook. Here is the Macro that I currently have:

Windows("Blkacc223508.xls").Activate
Worksheets("Total-1").Select
Range("C3:N14").Select
Selection.Copy
Windows("2008 worksheets.xls").Activate
Range("B59").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=True
Range("A72").Select
End Sub

Thanks in advance for your help.








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
when opening an Excel Workbook, another blank workbook also opens spmu Excel Discussion (Misc queries) 0 October 12th 07 01:46 PM
Volatile Macro for Adding Controls When Opening Workbook Wuddus Excel Discussion (Misc queries) 6 August 10th 06 05:52 PM
Enable macro on opening workbook ASU Excel Discussion (Misc queries) 5 July 3rd 06 05:40 PM
Run macro when opening workbook nsv Excel Discussion (Misc queries) 4 September 6th 05 12:19 PM
macro to start on workbook opening Nigel Excel Discussion (Misc queries) 1 May 13th 05 12:39 PM


All times are GMT +1. The time now is 03:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"