Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Import a data using a command button

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Import a data using a command button

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" wrote in message
...
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
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
command button to move data dummy Excel Worksheet Functions 3 December 5th 09 06:44 PM
Import Data, using a command line switch Balisteor Excel Discussion (Misc queries) 4 July 7th 09 06:46 PM
Import data button issue Erin J Excel Discussion (Misc queries) 0 March 19th 09 03:44 PM
Command button on data-entry form Susy Excel Discussion (Misc queries) 1 February 15th 05 01:46 AM
Command Button Code to copy data sho Excel Programming 3 July 7th 04 01:53 PM


All times are GMT +1. The time now is 04:30 AM.

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"