PC Review


Reply
Thread Tools Rate Thread

Import a data using a command button

 
 
=?Utf-8?B?TWFsbHk=?=
Guest
Posts: n/a
 
      27th Mar 2005
Hi all.

What I need is fairly simple, i think? I've put it into an example below.

I have two files e.g. C:\DIR1\file1.xls and C:\DIR2\file2.xls.

When i press a command button in file1 I want it to import the data from
cells A1:A7 in file2 and copy the DATA VALUES ONLY into cells A1:A7 in file1.

I have searched through other questions that have been posted on this page
but nothing really helps me.

Any help most appriciated.

Mally
 
Reply With Quote
 
 
 
 
Tom Ogilvy
Guest
Posts: n/a
 
      28th Mar 2005
Private Sub Commandbutton1_Click()
Dim bk as Workbook
set bk = Workbooks.Open("C:\DIR2\file2.xls")
bk.worksheets(1).Range("A1:A7").Copy
me.Range("A1:A7").PasteSpecial xlValues
bk.close SaveChanges:=False
End Sub

--
Regards,
Tom Ogilvy


"Mally" <(E-Mail Removed)> wrote in message
news:B6D37746-1E19-4AD5-9ED2-(E-Mail Removed)...
> Hi all.
>
> What I need is fairly simple, i think? I've put it into an example below.
>
> I have two files e.g. C:\DIR1\file1.xls and C:\DIR2\file2.xls.
>
> When i press a command button in file1 I want it to import the data from
> cells A1:A7 in file2 and copy the DATA VALUES ONLY into cells A1:A7 in

file1.
>
> I have searched through other questions that have been posted on this page
> but nothing really helps me.
>
> Any help most appriciated.
>
> Mally



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deselect Command Button by Selecting another Command Button gmcnaugh Microsoft Excel Programming 3 2nd Sep 2008 05:59 PM
Command Button Pictures Taken from Command Bar Button Icons acx@centrum.cz Microsoft Access Forms 0 2nd Dec 2007 01:23 PM
VB's Command Button vs Form's Command Button Ronald Dodge Microsoft Excel Programming 3 24th May 2006 02:23 PM
after a ftp put command it just says "200 PORT command successful." and hangs forever. What could be wrong? when i test the ftp server using IE in "passive" mode it works fine. but ftp at command line hangs on "200 PORT comma Daniel Microsoft Windows 2000 Security 6 1st May 2006 02:51 PM
after a ftp put command it just says "200 PORT command successful." and hangs forever. What could be wrong? when i test the ftp server using IE in "passive" mode it works fine. but ftp at command line hangs on "200 PORT comma Daniel Microsoft Windows 2000 1 29th Apr 2006 02:05 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:48 AM.