Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Opening a worksheet in VBA

Hello all. From a active worksheet I would like to open another
worksheet(in VBA) in a separate workbook and copy it's contents to the
initial worksheet. I would like this to happen without the 2nd
worksheet showing at all. Can I grab the contents of the other
worksheet without it actually opening in excel(visually)?
I can open the worksheet copy its contents and then close it,
but I don't want the user to see this happening.
Thanks,
GG


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Opening a worksheet in VBA

Hi

Try something like this

Sub test()
Dim Wb1 As Workbook
Dim Wb2 As Workbook
Application.ScreenUpdating = False
Set Wb1 = ActiveWorkbook
Set Wb2 = Workbooks.Open("C:\data\a.xls")
Wb2.Sheets("Sheet1").Range("A1:C1").Copy _
Wb1.Sheets("Sheet1").Range("A1")
Wb2.Close False
Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"gwgeller " wrote in message ...
Hello all. From a active worksheet I would like to open another
worksheet(in VBA) in a separate workbook and copy it's contents to the
initial worksheet. I would like this to happen without the 2nd
worksheet showing at all. Can I grab the contents of the other
worksheet without it actually opening in excel(visually)?
I can open the worksheet copy its contents and then close it,
but I don't want the user to see this happening.
Thanks,
GG


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Opening a worksheet in VBA

Precede it with

Application.Screenupdating = False

and set to True after.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"gwgeller " wrote in message
...
Hello all. From a active worksheet I would like to open another
worksheet(in VBA) in a separate workbook and copy it's contents to the
initial worksheet. I would like this to happen without the 2nd
worksheet showing at all. Can I grab the contents of the other
worksheet without it actually opening in excel(visually)?
I can open the worksheet copy its contents and then close it,
but I don't want the user to see this happening.
Thanks,
GG


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Opening a worksheet in VBA

works nice, thank you

--
Message posted from http://www.ExcelForum.com

Reply
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
Opening worksheet Judy Excel Discussion (Misc queries) 1 February 9th 09 01:55 PM
Opening Worksheet Mike Excel Discussion (Misc queries) 1 October 17th 06 04:21 PM
Opening a worksheet ssigler Excel Discussion (Misc queries) 1 May 12th 06 08:16 PM
VBA Opening worksheet, name changes Jeff Excel Discussion (Misc queries) 5 September 20th 05 06:00 PM
Opening a New Worksheet PT New Users to Excel 1 April 13th 05 01:43 AM


All times are GMT +1. The time now is 08:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"