Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 4th, 2008, 06:22 PM
Authorized User
 
Join Date: Jun 2008
Location: sydney, nsw, Australia.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to mona_upm84
Default Copy from cell A3 workbookA into cell A3 workbookB

Hi all,

I need some help... Let say from a userform, there is a comboBox1 list all .xls files in My Document. As soon as the user choose one of the list and click Submit, userform closed and data from cell A3 in selected .xls copied into A3 of the current workbook, Sheet1.

How can i do that? I tried many ways, but failed. Hope somebody can help me....

Reply With Quote
  #2 (permalink)  
Old September 5th, 2008, 01:31 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi Mona

Here is a hint.

Code:
Private Sub CommandButton1_Click()

Dim sWB As String
Dim sPath As String
Dim oWB1 As Workbook
Dim oWB2 As Workbook
 
 
sPath = "c:\temp\"
sWB = ComboBox1.Value

Unload Me

Set oWB1 = ActiveWorkbook
Set oWB2 = Workbooks.Open(sPath & sWB)

oWB1.Sheets(1).Range("A3").Value = oWB2.Sheets(1).Range("A3").Value

oWB2.Close (False)

End Sub
Cheers
Shasur

http://www.dotnetdud.blogspot.com

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy cell into userform? Cabbage VB How-To 2 April 29th, 2008 07:04 AM
copy columns based on cell values EricB123 Excel VBA 0 December 18th, 2007 12:51 AM
Copy data into cell by cell zone Excel VBA 2 September 4th, 2007 11:50 AM
I need to refer a cell within a cell like =RC[ RC2 chakravarthi_os Excel VBA 1 September 24th, 2006 08:19 AM
Lose cell Text when editing cell in VSFlexGrid 6 bobcratchet VB How-To 0 July 30th, 2004 09:32 AM



All times are GMT -4. The time now is 10:52 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.