LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Selecting data from another workbook

Private Sub cmdGet_Click()

If Not FileExists("S:\MHE Monitor\subcon.xls") Then
MsgBox "The file doesn't exist!"
Else
Workbooks.Open "S:\MHE Monitor\subcon.xls"
Sheets("Sheet1").Select
With Activesheet
.Cells(1, 1).Select
.Range(.Range("A1"), _
ActiveCell.SpecialCells(xlLastCell)).Copy
End With
Workbooks("Subcon Out.xls").Activate
ActiveSheet.Cells(1, 3).Select
'Selection.Paste
'Workbooks("subcon.xls").Close SaveChanges:=False
End If

End Sub

--
Regards,
Tom Ogilvy


"gti_jobert" wrote
in message ...

Cheers bob, I will do as you suggested! A quick question though - I have
a cmdButton on a sheet and am trying to select a range but it keep
coming up with an error "Method 'Range' of Object '_Worksheet' Failed".
I have the following code;


Code:
--------------------
Private Sub cmdGet_Click()

If Not FileExists("S:\MHE Monitor\subcon.xls") Then
MsgBox "The file doesn't exist!"
Else
Workbooks.Open "S:\MHE Monitor\subcon.xls"
Sheets("Sheet1").Select
ActiveSheet.Cells(1, 1).Select
*Range(Range("A1"), ActiveCell.SpecialCells(xlLastCell)).Copy*
Workbooks("Subcon Out.xls").Activate
ActiveSheet.Cells(1, 3).Select
'Selection.Paste
'Workbooks("subcon.xls").Close SaveChanges:=False
End If

End Sub
--------------------


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile:

http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=518700



 
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
Selecting used cells only in the workbook Sandeep Excel Discussion (Misc queries) 4 July 31st 07 01:04 PM
Selecting data from 1 workbook to copy and paste to a 2nd workbook JackSpam Excel Programming 2 July 20th 05 02:33 AM
Selecting a worksheet in a workbook Lazer[_8_] Excel Programming 1 August 24th 04 08:52 PM
Selecting workbook Lazer[_6_] Excel Programming 3 August 24th 04 08:12 PM
Help!!!! Selecting a cell in another workbook AndyGoz Excel Programming 1 July 24th 04 12:32 AM


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