Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() You don't need to select/activate the workbooks. Is the code in the activeworkbook & you want to copy B2 from workbook1.xls? Code: -------------------- Option Explicit Function IsOpen(wbName As String) As Boolean Dim Wb As Workbook On Error Resume Next Set Wb = Workbooks(wbName) If Err = 0 Then IsOpen = True End Function Sub copyRange() Dim sFilName As String sFilName = "WorkBook1.xls" If Not IsOpen(sFilName) Then Workbooks.Open _ ("C:" & sFilName & ".xls") Workbooks(sFilName).Sheet1.Cells(2, 2).Copy _ ThisWorkbook.Sheet1.Cells(2, 2) End Sub -------------------- -- royUK Hope that helps, RoyUK For tips & examples visit my 'web site ' (http://www.excel-it.com) ------------------------------------------------------------------------ royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=28001 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Store cell & workbook references, to retrieve later in Macro | Excel Programming | |||
need macro to call a workbook w/o the actual name of the workbook | Excel Programming | |||
Help:Running a macro in one excel workbook from another workbook | Setting up and Configuration of Excel | |||
Code in one workbook to call code in another XL file | Excel Programming | |||
Running a macro to protect a workbook on a already protected workbook UNprotects the workbook ?? | Excel Programming |