LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default Importing data

Hi,

I have a piece of code that imports data from one workbook to another:

SourceBook = Range("e9")
'This is called 071203 PRG Risk log v 2.00.xls
TargetBook = Range("e4")
'This is called PRG Metrics.xls

Workbooks.Open Filename:=SourceBook
Sheets("Navigation").Select
Sheets("Sandpit").Visible = True
Sheets("Sandpit").Select
Cells.Select
Selection.Copy
Windows("PRG Metrics.xls").Activate
Sheets("Data").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("A1").Select
Sheets("Navigation").Select
Windows("071203 PRG Risk log v 2.00.xls").Activate
Sheets("Sandpit").Select
ActiveWindow.SelectedSheets.Visible = False
Workbooks("071203 PRG Risk log v 2.00.xls").Close SaveChanges = False

This code works as I want it to.

Can anyone tell me how I can replace the references to specific filenames
(eg. Windows("PRG Metrics.xls").Activate) with references to SourceBook and
TargetBook (so that it would look like Windows(TargetBoook).Activate)?

I'm working on this in Office 2007 but it will be running on Office 2003, if
that makes any difference.

Apologies if this is a simple thing, but I'm not much of a "softie".

TIA

Dave


 
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
Missing Cloumn data when importing external data Findus Excel Discussion (Misc queries) 0 December 16th 08 11:22 AM
Importing:Data Connection Wizard Doesn't see Source Data - No Impo Exotic Hadron Excel Discussion (Misc queries) 0 October 1st 08 07:35 PM
Removing Data Tables formed from importing data from Access Andrea Jones Excel Discussion (Misc queries) 0 April 10th 08 12:01 PM
Importing data: OLE DB and data link properties dialog Vivek Excel Programming 0 October 22nd 07 04:03 PM
Importing data, then adding data to the new spreadsheet.. a conund AndyL82 Excel Discussion (Misc queries) 1 March 9th 06 10:05 PM


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