Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Macro to update active workbook in one folder

I have a macro to update inventory in the workbook the macro is written in,
however when saved with a new name the macro will not work. How should the
macro be written to update saved files that are kept in the same folder. The
folder name is "Quote Workbook", the file names will range from 630000 to
659999.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default Macro to update active workbook in one folder

You should always post your code for comments/suggestions Perhaps

activeworkbook

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike @ GD" wrote in message
...
I have a macro to update inventory in the workbook the macro is written in,
however when saved with a new name the macro will not work. How should the
macro be written to update saved files that are kept in the same folder.
The
folder name is "Quote Workbook", the file names will range from 630000 to
659999.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Macro to update active workbook in one folder

Sorry...new at this, here's the code

Sub Update()

'
' Update Macro
' Macro recorded 12/15/2008 by micmul
'
Application.ScreenUpdating = False
Workbooks.Open Filename:= _
"C:\Documents and Settings\micmul\Desktop\Quote
Workbook\inventory.xls"
Cells.Select
Selection.Copy
Windows("Template.xls").Activate
Sheets("Inventory").Select
Cells.Select
ActiveSheet.Paste
Windows("inventory.xls").Activate
Range("D15").Select
Application.CutCopyMode = False
ActiveWindow.Close
Range("H19").Select
Sheets("Quote").Select
Application.ScreenUpdating = True

End Sub

"Don Guillett" wrote:

You should always post your code for comments/suggestions Perhaps

activeworkbook

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike @ GD" wrote in message
...
I have a macro to update inventory in the workbook the macro is written in,
however when saved with a new name the macro will not work. How should the
macro be written to update saved files that are kept in the same folder.
The
folder name is "Quote Workbook", the file names will range from 630000 to
659999.



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default Macro to update active workbook in one folder

One way to copy from a workbook to your ACTIVE workbook

Sub copytoactiveworkbook()
mywb = "C:\yourworkbooknamehere.xls"
mysht = "yoursourcesheetnamehere"
myrng = "B73:F79"
Application.ScreenUpdating = False
Workbooks.Open Filename:=mywb
Sheets(mysht).Range(myrng).Copy
ActiveWindow.Close True
Range("E6").Select
ActiveSheet.Paste
Application.ScreenUpdating = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike @ GD" wrote in message
...
Sorry...new at this, here's the code

Sub Update()

'
' Update Macro
' Macro recorded 12/15/2008 by micmul
'
Application.ScreenUpdating = False
Workbooks.Open Filename:= _
"C:\Documents and Settings\micmul\Desktop\Quote
Workbook\inventory.xls"
Cells.Select
Selection.Copy
Windows("Template.xls").Activate
Sheets("Inventory").Select
Cells.Select
ActiveSheet.Paste
Windows("inventory.xls").Activate
Range("D15").Select
Application.CutCopyMode = False
ActiveWindow.Close
Range("H19").Select
Sheets("Quote").Select
Application.ScreenUpdating = True

End Sub

"Don Guillett" wrote:

You should always post your code for comments/suggestions Perhaps

activeworkbook

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike @ GD" wrote in message
...
I have a macro to update inventory in the workbook the macro is written
in,
however when saved with a new name the macro will not work. How should
the
macro be written to update saved files that are kept in the same
folder.
The
folder name is "Quote Workbook", the file names will range from 630000
to
659999.




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Macro to update active workbook in one folder

Getting a run time error 9, sub script out of range @ point of
"Sheets(mysht).Range(myrng).Copy".

Below is the script as it is.

Sub Update()

'
' Update Macro
' Macro recorded 12/15/2008 by micmul
'
Sub copytoactiveworkbook()
mywb = "C:\Documents and Settings\micmul\Desktop\Quote Workbook\inventory.xls"
mysht = "Inventory"
myrng = "A1:U5511"
Application.ScreenUpdating = False
Workbooks.Open Filename:=mywb
Sheets(mysht).Range(myrng).Copy
ActiveWindow.Close True
Range("E6").Select
ActiveSheet.Paste
Application.ScreenUpdating = True
End Sub

"Don Guillett" wrote:

One way to copy from a workbook to your ACTIVE workbook

Sub copytoactiveworkbook()
mywb = "C:\yourworkbooknamehere.xls"
mysht = "yoursourcesheetnamehere"
myrng = "B73:F79"
Application.ScreenUpdating = False
Workbooks.Open Filename:=mywb
Sheets(mysht).Range(myrng).Copy
ActiveWindow.Close True
Range("E6").Select
ActiveSheet.Paste
Application.ScreenUpdating = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike @ GD" wrote in message
...
Sorry...new at this, here's the code

Sub Update()

'
' Update Macro
' Macro recorded 12/15/2008 by micmul
'
Application.ScreenUpdating = False
Workbooks.Open Filename:= _
"C:\Documents and Settings\micmul\Desktop\Quote
Workbook\inventory.xls"
Cells.Select
Selection.Copy
Windows("Template.xls").Activate
Sheets("Inventory").Select
Cells.Select
ActiveSheet.Paste
Windows("inventory.xls").Activate
Range("D15").Select
Application.CutCopyMode = False
ActiveWindow.Close
Range("H19").Select
Sheets("Quote").Select
Application.ScreenUpdating = True

End Sub

"Don Guillett" wrote:

You should always post your code for comments/suggestions Perhaps

activeworkbook

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike @ GD" wrote in message
...
I have a macro to update inventory in the workbook the macro is written
in,
however when saved with a new name the macro will not work. How should
the
macro be written to update saved files that are kept in the same
folder.
The
folder name is "Quote Workbook", the file names will range from 630000
to
659999.






  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default Macro to update active workbook in one folder

Hi,

Modify Don's code with a couple of DIM statemensts

Sub copytoactiveworkbook()
Dim mywb As String
Dim mysht As String
Dim myrng As String
mywb = "C:\yourworkbooknamehere.xls"
mysht = "yoursourcesheetnamehere"
myrng = "B73:F79"
Application.ScreenUpdating = False
Workbooks.Open Filename:=mywb
Sheets(mysht).Range(myrng).Copy
ActiveWindow.Close True
Range("E6").Select
ActiveSheet.Paste
Application.ScreenUpdating = True
End Sub

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Mike @ GD" wrote:

Getting a run time error 9, sub script out of range @ point of
"Sheets(mysht).Range(myrng).Copy".

Below is the script as it is.

Sub Update()

'
' Update Macro
' Macro recorded 12/15/2008 by micmul
'
Sub copytoactiveworkbook()
mywb = "C:\Documents and Settings\micmul\Desktop\Quote Workbook\inventory.xls"
mysht = "Inventory"
myrng = "A1:U5511"
Application.ScreenUpdating = False
Workbooks.Open Filename:=mywb
Sheets(mysht).Range(myrng).Copy
ActiveWindow.Close True
Range("E6").Select
ActiveSheet.Paste
Application.ScreenUpdating = True
End Sub

"Don Guillett" wrote:

One way to copy from a workbook to your ACTIVE workbook

Sub copytoactiveworkbook()
mywb = "C:\yourworkbooknamehere.xls"
mysht = "yoursourcesheetnamehere"
myrng = "B73:F79"
Application.ScreenUpdating = False
Workbooks.Open Filename:=mywb
Sheets(mysht).Range(myrng).Copy
ActiveWindow.Close True
Range("E6").Select
ActiveSheet.Paste
Application.ScreenUpdating = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike @ GD" wrote in message
...
Sorry...new at this, here's the code

Sub Update()

'
' Update Macro
' Macro recorded 12/15/2008 by micmul
'
Application.ScreenUpdating = False
Workbooks.Open Filename:= _
"C:\Documents and Settings\micmul\Desktop\Quote
Workbook\inventory.xls"
Cells.Select
Selection.Copy
Windows("Template.xls").Activate
Sheets("Inventory").Select
Cells.Select
ActiveSheet.Paste
Windows("inventory.xls").Activate
Range("D15").Select
Application.CutCopyMode = False
ActiveWindow.Close
Range("H19").Select
Sheets("Quote").Select
Application.ScreenUpdating = True

End Sub

"Don Guillett" wrote:

You should always post your code for comments/suggestions Perhaps

activeworkbook

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike @ GD" wrote in message
...
I have a macro to update inventory in the workbook the macro is written
in,
however when saved with a new name the macro will not work. How should
the
macro be written to update saved files that are kept in the same
folder.
The
folder name is "Quote Workbook", the file names will range from 630000
to
659999.




  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Macro to update active workbook in one folder

Shane, & Don,

Thanks for the help, all is working well. The only issue at this point is
the anoying popup's for the clip board, is the a alternative to this, would
their be a difference between the windows and system clipboard???.

"Shane Devenshire" wrote:

Hi,

Modify Don's code with a couple of DIM statemensts

Sub copytoactiveworkbook()
Dim mywb As String
Dim mysht As String
Dim myrng As String
mywb = "C:\yourworkbooknamehere.xls"
mysht = "yoursourcesheetnamehere"
myrng = "B73:F79"
Application.ScreenUpdating = False
Workbooks.Open Filename:=mywb
Sheets(mysht).Range(myrng).Copy
ActiveWindow.Close True
Range("E6").Select
ActiveSheet.Paste
Application.ScreenUpdating = True
End Sub

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Mike @ GD" wrote:

Getting a run time error 9, sub script out of range @ point of
"Sheets(mysht).Range(myrng).Copy".

Below is the script as it is.

Sub Update()

'
' Update Macro
' Macro recorded 12/15/2008 by micmul
'
Sub copytoactiveworkbook()
mywb = "C:\Documents and Settings\micmul\Desktop\Quote Workbook\inventory.xls"
mysht = "Inventory"
myrng = "A1:U5511"
Application.ScreenUpdating = False
Workbooks.Open Filename:=mywb
Sheets(mysht).Range(myrng).Copy
ActiveWindow.Close True
Range("E6").Select
ActiveSheet.Paste
Application.ScreenUpdating = True
End Sub

"Don Guillett" wrote:

One way to copy from a workbook to your ACTIVE workbook

Sub copytoactiveworkbook()
mywb = "C:\yourworkbooknamehere.xls"
mysht = "yoursourcesheetnamehere"
myrng = "B73:F79"
Application.ScreenUpdating = False
Workbooks.Open Filename:=mywb
Sheets(mysht).Range(myrng).Copy
ActiveWindow.Close True
Range("E6").Select
ActiveSheet.Paste
Application.ScreenUpdating = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike @ GD" wrote in message
...
Sorry...new at this, here's the code

Sub Update()

'
' Update Macro
' Macro recorded 12/15/2008 by micmul
'
Application.ScreenUpdating = False
Workbooks.Open Filename:= _
"C:\Documents and Settings\micmul\Desktop\Quote
Workbook\inventory.xls"
Cells.Select
Selection.Copy
Windows("Template.xls").Activate
Sheets("Inventory").Select
Cells.Select
ActiveSheet.Paste
Windows("inventory.xls").Activate
Range("D15").Select
Application.CutCopyMode = False
ActiveWindow.Close
Range("H19").Select
Sheets("Quote").Select
Application.ScreenUpdating = True

End Sub

"Don Guillett" wrote:

You should always post your code for comments/suggestions Perhaps

activeworkbook

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike @ GD" wrote in message
...
I have a macro to update inventory in the workbook the macro is written
in,
however when saved with a new name the macro will not work. How should
the
macro be written to update saved files that are kept in the same
folder.
The
folder name is "Quote Workbook", the file names will range from 630000
to
659999.




  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default Macro to update active workbook in one folder


try
application.displayalerts=false
code
application.displayalerts=true

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike @ GD" wrote in message
...
Shane, & Don,

Thanks for the help, all is working well. The only issue at this point is
the anoying popup's for the clip board, is the a alternative to this,
would
their be a difference between the windows and system clipboard???.

"Shane Devenshire" wrote:

Hi,

Modify Don's code with a couple of DIM statemensts

Sub copytoactiveworkbook()
Dim mywb As String
Dim mysht As String
Dim myrng As String
mywb = "C:\yourworkbooknamehere.xls"
mysht = "yoursourcesheetnamehere"
myrng = "B73:F79"
Application.ScreenUpdating = False
Workbooks.Open Filename:=mywb
Sheets(mysht).Range(myrng).Copy
ActiveWindow.Close True
Range("E6").Select
ActiveSheet.Paste
Application.ScreenUpdating = True
End Sub

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Mike @ GD" wrote:

Getting a run time error 9, sub script out of range @ point of
"Sheets(mysht).Range(myrng).Copy".

Below is the script as it is.

Sub Update()

'
' Update Macro
' Macro recorded 12/15/2008 by micmul
'
Sub copytoactiveworkbook()
mywb = "C:\Documents and Settings\micmul\Desktop\Quote
Workbook\inventory.xls"
mysht = "Inventory"
myrng = "A1:U5511"
Application.ScreenUpdating = False
Workbooks.Open Filename:=mywb
Sheets(mysht).Range(myrng).Copy
ActiveWindow.Close True
Range("E6").Select
ActiveSheet.Paste
Application.ScreenUpdating = True
End Sub

"Don Guillett" wrote:

One way to copy from a workbook to your ACTIVE workbook

Sub copytoactiveworkbook()
mywb = "C:\yourworkbooknamehere.xls"
mysht = "yoursourcesheetnamehere"
myrng = "B73:F79"
Application.ScreenUpdating = False
Workbooks.Open Filename:=mywb
Sheets(mysht).Range(myrng).Copy
ActiveWindow.Close True
Range("E6").Select
ActiveSheet.Paste
Application.ScreenUpdating = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike @ GD" wrote in message
...
Sorry...new at this, here's the code

Sub Update()

'
' Update Macro
' Macro recorded 12/15/2008 by micmul
'
Application.ScreenUpdating = False
Workbooks.Open Filename:= _
"C:\Documents and Settings\micmul\Desktop\Quote
Workbook\inventory.xls"
Cells.Select
Selection.Copy
Windows("Template.xls").Activate
Sheets("Inventory").Select
Cells.Select
ActiveSheet.Paste
Windows("inventory.xls").Activate
Range("D15").Select
Application.CutCopyMode = False
ActiveWindow.Close
Range("H19").Select
Sheets("Quote").Select
Application.ScreenUpdating = True

End Sub

"Don Guillett" wrote:

You should always post your code for comments/suggestions Perhaps

activeworkbook

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike @ GD" wrote in message
...
I have a macro to update inventory in the workbook the macro is
written
in,
however when saved with a new name the macro will not work. How
should
the
macro be written to update saved files that are kept in the same
folder.
The
folder name is "Quote Workbook", the file names will range from
630000
to
659999.





  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Macro to update active workbook in one folder

DOn,

That did the trick, thanks very much to you and Shane.

"Don Guillett" wrote:


try
application.displayalerts=false
code
application.displayalerts=true

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike @ GD" wrote in message
...
Shane, & Don,

Thanks for the help, all is working well. The only issue at this point is
the anoying popup's for the clip board, is the a alternative to this,
would
their be a difference between the windows and system clipboard???.

"Shane Devenshire" wrote:

Hi,

Modify Don's code with a couple of DIM statemensts

Sub copytoactiveworkbook()
Dim mywb As String
Dim mysht As String
Dim myrng As String
mywb = "C:\yourworkbooknamehere.xls"
mysht = "yoursourcesheetnamehere"
myrng = "B73:F79"
Application.ScreenUpdating = False
Workbooks.Open Filename:=mywb
Sheets(mysht).Range(myrng).Copy
ActiveWindow.Close True
Range("E6").Select
ActiveSheet.Paste
Application.ScreenUpdating = True
End Sub

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Mike @ GD" wrote:

Getting a run time error 9, sub script out of range @ point of
"Sheets(mysht).Range(myrng).Copy".

Below is the script as it is.

Sub Update()

'
' Update Macro
' Macro recorded 12/15/2008 by micmul
'
Sub copytoactiveworkbook()
mywb = "C:\Documents and Settings\micmul\Desktop\Quote
Workbook\inventory.xls"
mysht = "Inventory"
myrng = "A1:U5511"
Application.ScreenUpdating = False
Workbooks.Open Filename:=mywb
Sheets(mysht).Range(myrng).Copy
ActiveWindow.Close True
Range("E6").Select
ActiveSheet.Paste
Application.ScreenUpdating = True
End Sub

"Don Guillett" wrote:

One way to copy from a workbook to your ACTIVE workbook

Sub copytoactiveworkbook()
mywb = "C:\yourworkbooknamehere.xls"
mysht = "yoursourcesheetnamehere"
myrng = "B73:F79"
Application.ScreenUpdating = False
Workbooks.Open Filename:=mywb
Sheets(mysht).Range(myrng).Copy
ActiveWindow.Close True
Range("E6").Select
ActiveSheet.Paste
Application.ScreenUpdating = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike @ GD" wrote in message
...
Sorry...new at this, here's the code

Sub Update()

'
' Update Macro
' Macro recorded 12/15/2008 by micmul
'
Application.ScreenUpdating = False
Workbooks.Open Filename:= _
"C:\Documents and Settings\micmul\Desktop\Quote
Workbook\inventory.xls"
Cells.Select
Selection.Copy
Windows("Template.xls").Activate
Sheets("Inventory").Select
Cells.Select
ActiveSheet.Paste
Windows("inventory.xls").Activate
Range("D15").Select
Application.CutCopyMode = False
ActiveWindow.Close
Range("H19").Select
Sheets("Quote").Select
Application.ScreenUpdating = True

End Sub

"Don Guillett" wrote:

You should always post your code for comments/suggestions Perhaps

activeworkbook

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike @ GD" wrote in message
...
I have a macro to update inventory in the workbook the macro is
written
in,
however when saved with a new name the macro will not work. How
should
the
macro be written to update saved files that are kept in the same
folder.
The
folder name is "Quote Workbook", the file names will range from
630000
to
659999.






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
Personal Macro Workbook in startup folder missing Susan Rochon Excel Discussion (Misc queries) 3 September 17th 09 02:44 AM
Macro to copy active worksheet to new workbook Macca Excel Discussion (Misc queries) 1 May 25th 08 02:07 PM
Move Active Workbook to another Folder jonallen51 Excel Discussion (Misc queries) 0 March 12th 08 07:41 PM
Update Macro: Leave Colour As Before Once Cell is Not Active JB2010 Excel Discussion (Misc queries) 2 February 2nd 06 06:08 PM
Macro: Exit active workbook without save? Don Excel Worksheet Functions 0 May 20th 05 06:47 AM


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