ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Macro to update active workbook in one folder (https://www.excelbanter.com/excel-worksheet-functions/216082-macro-update-active-workbook-one-folder.html)

Mike @ GD

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.

Don Guillett

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.



Mike @ GD

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.




Don Guillett

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.





Mike @ GD

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.





Shane Devenshire[_2_]

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.





Mike @ GD

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.





Don Guillett

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.






Mike @ GD

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.








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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com