Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Locate Workbook
Hi to all you nice GURU's who have helped me SO much. First of all, Thank You.
Now to my question; I have a workbook that stores "data" into another workbook, then hides the "data" workbook. All works well with this macro; Sub testmove1() ' ' testmove1 Macro ' ' Range("I5:I7").Select Selection.Copy Workbooks.Open Filename:= _ "C:\Documents and Settings\Kev\Desktop\HyVee\Project\BOtestdata.xls" Windows("BOtestdata.xls").Activate Range("K1").Select ActiveSheet.Paste ActiveWindow.Visible = False Range("E12").Select End Sub My problem is I'm building this at home for the office. When I transfer this to my office, how to I "without having to "remake the macro", find the data workbook. I have it in the same dir as the source but the only way I can get it to work is as in the code above. Thank You -- ....kev... |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Locate Workbook
Use GetOpenFilename
Sub testmove1() Dim sFilename As String Dim oWBTarget As Workbook Range("I5:I7").Copy sFilename = Application _ .GetOpenFilename("Microsoft Excel Files (*.xls), *.xls") If sFilename < False Then Set oWBTarget = Workbooks.Open(Filename:=sFilename) oWBTarget.Activate Range("K1").Select ActiveSheet.Paste ActiveWindow.Visible = False Range("E12").Select End If End Sub -- --- HTH Bob (change the xxxx to gmail if mailing direct) "kev" wrote in message ... Hi to all you nice GURU's who have helped me SO much. First of all, Thank You. Now to my question; I have a workbook that stores "data" into another workbook, then hides the "data" workbook. All works well with this macro; Sub testmove1() ' ' testmove1 Macro ' ' Range("I5:I7").Select Selection.Copy Workbooks.Open Filename:= _ "C:\Documents and Settings\Kev\Desktop\HyVee\Project\BOtestdata.xls" Windows("BOtestdata.xls").Activate Range("K1").Select ActiveSheet.Paste ActiveWindow.Visible = False Range("E12").Select End Sub My problem is I'm building this at home for the office. When I transfer this to my office, how to I "without having to "remake the macro", find the data workbook. I have it in the same dir as the source but the only way I can get it to work is as in the code above. Thank You -- ...kev... |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Locate Workbook
Thanks a Mil...
Works like a charm :) -- ....kev... "Bob Phillips" wrote: Use GetOpenFilename Sub testmove1() Dim sFilename As String Dim oWBTarget As Workbook Range("I5:I7").Copy sFilename = Application _ .GetOpenFilename("Microsoft Excel Files (*.xls), *.xls") If sFilename < False Then Set oWBTarget = Workbooks.Open(Filename:=sFilename) oWBTarget.Activate Range("K1").Select ActiveSheet.Paste ActiveWindow.Visible = False Range("E12").Select End If End Sub -- --- HTH Bob (change the xxxx to gmail if mailing direct) "kev" wrote in message ... Hi to all you nice GURU's who have helped me SO much. First of all, Thank You. Now to my question; I have a workbook that stores "data" into another workbook, then hides the "data" workbook. All works well with this macro; Sub testmove1() ' ' testmove1 Macro ' ' Range("I5:I7").Select Selection.Copy Workbooks.Open Filename:= _ "C:\Documents and Settings\Kev\Desktop\HyVee\Project\BOtestdata.xls" Windows("BOtestdata.xls").Activate Range("K1").Select ActiveSheet.Paste ActiveWindow.Visible = False Range("E12").Select End Sub My problem is I'm building this at home for the office. When I transfer this to my office, how to I "without having to "remake the macro", find the data workbook. I have it in the same dir as the source but the only way I can get it to work is as in the code above. Thank You -- ...kev... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) | Excel Worksheet Functions | |||
excel exits unexpectedly or hangs the second time I open workbook | Excel Discussion (Misc queries) | |||
Repost:Automatically inserting a row in external workbook | Excel Discussion (Misc queries) | |||
keeping a toolbar attached to a workbook | Excel Discussion (Misc queries) | |||
How to hyperlink from a workbook to sheets in another workbook? | Excel Worksheet Functions |