ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Working with a WK1 format... (https://www.excelbanter.com/excel-programming/274526-re-working-wk1-format.html)

Randy Schwanke

Working with a WK1 format...
 
Thank you,

In the mean time I came up with this, it's very crude, but appears to
work...

Sub First()
Sheets("Lode").Select
Range("A1:D3500").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("A1").Select
Sheets("Cougar").Select
Application.Dialogs(xlDialogOpen).Show arg1:="H:\US Cable\*.WK1"

Range("A1:D3500").Select
Selection.Copy
Application.ActiveWindow.Close "YES"
SENDKEYS "{Enter}", False
ActiveWindow.ActivatePrevious

Sheets("Lode").Select
Range("A1").Select
ActiveSheet.Paste
Range("A1").Select
Sheets("Cougar").Select
Range("A1").Select

ActiveWindow.ActivatePrevious
Application.CutCopyMode = False
'ActiveWorkbook.Close
ActiveWindow.WindowState = xlMaximized

End Sub



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

steve

Working with a WK1 format...
 
Randy,

If it works its great.

But you can make it better.

Learn to eliminate "Select", makes the code simpler and faster
And unless you did a copy somewhere before this, don't know why you need
Application.CutCopyMode = False
Use it after the paste.

Sheets("Lode").Select
Range("A1:D3500").Select
Application.CutCopyMode = False
Selection.ClearContents

Might be replaced with
Sheets("Lode").Range("A1:D3500").ClearContents

And you can copy and paste real easy
Workbooks("wb1").Sheets("Sheet1").Range("A1:D3500" ).Copy _
Destination:=Workbooks("wb2").Sheets("Sheet1").Ran ge("A1")
(make your substitutes for wb1, wb2, Sheet1)
If its in the same workbook than you don't need to have the Workbooks part.

steve

"Randy Schwanke" wrote in message
...
Thank you,

In the mean time I came up with this, it's very crude, but appears to
work...

Sub First()
Sheets("Lode").Select
Range("A1:D3500").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("A1").Select
Sheets("Cougar").Select
Application.Dialogs(xlDialogOpen).Show arg1:="H:\US Cable\*.WK1"

Range("A1:D3500").Select
Selection.Copy
Application.ActiveWindow.Close "YES"
SENDKEYS "{Enter}", False
ActiveWindow.ActivatePrevious

Sheets("Lode").Select
Range("A1").Select
ActiveSheet.Paste
Range("A1").Select
Sheets("Cougar").Select
Range("A1").Select

ActiveWindow.ActivatePrevious
Application.CutCopyMode = False
'ActiveWorkbook.Close
ActiveWindow.WindowState = xlMaximized

End Sub



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




Randy Schwanke

Working with a WK1 format...
 
Thank you for the tips and suggestions, and you are very correct, I can
certainly make it better, I agree.

I'll review what you had indicated and certainly will try do those,
being new to this all, I'm at a disadvantage, but at least I try to
attain what I need, crude though it might be...

Thanks again,

Randy



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 07:00 PM.

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