Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro/VBA help - lots of xls imports


I have 3 spreadsheets A, B and C

A & B contain information in the exact same format

With C I have 2 columns that compare their values against each other
and highlight any differences(through a small VBA script)

I want 2 buttons in C spreadsheet that:

Button 1: Offers the user to open a spreadsheet(A - name can vary) then
copies A2:A500 of that spreadsheet to spreadsheet C(A2:A500)

Button 2: Offers the user to open a spreadsheet(B - name can vary) then
copies B2:B500 of that spreadsheet to spreadsheet C(B2:B500)

Any ideas if this is possible


--
Steve M
------------------------------------------------------------------------
Steve M's Profile: http://www.excelforum.com/member.php...o&userid=32520
View this thread: http://www.excelforum.com/showthread...hreadid=523047

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Macro/VBA help - lots of xls imports

Sub GetfromA()
Dim fName as Variant
Dim bk as Workbook, sh as Worksheet
set sh = Activesheet
fname = Application.GetOpenfilename("Excel Files (*.xls),*.xls")
if fName = False then exit sub
set bk = Workbooks.Open(fName)
bk.Worksheets(1).Range("A2:A500").copy _
Destination:=sh.Range("A2")
bk.close SaveChanges:=False
End Sub


Sub GetfromB()
Dim fName as Variant
Dim bk as Workbook, sh as Worksheet
set sh = Activesheet
fname = Application.GetOpenfilename("Excel Files (*.xls),*.xls")
if fName = False then exit sub
set bk = Workbooks.Open(fName)
bk.Worksheets(1).Range("B2:B500").copy _
Destination:=sh.Range("B2")
bk.close SaveChanges:=False
End Sub

--
Regards,
Tom Ogilvy



"Steve M" wrote:


I have 3 spreadsheets A, B and C

A & B contain information in the exact same format

With C I have 2 columns that compare their values against each other
and highlight any differences(through a small VBA script)

I want 2 buttons in C spreadsheet that:

Button 1: Offers the user to open a spreadsheet(A - name can vary) then
copies A2:A500 of that spreadsheet to spreadsheet C(A2:A500)

Button 2: Offers the user to open a spreadsheet(B - name can vary) then
copies B2:B500 of that spreadsheet to spreadsheet C(B2:B500)

Any ideas if this is possible


--
Steve M
------------------------------------------------------------------------
Steve M's Profile: http://www.excelforum.com/member.php...o&userid=32520
View this thread: http://www.excelforum.com/showthread...hreadid=523047


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro/VBA help - lots of xls imports


I will point you in the right direction as I am just off to a meeting.

use tools record macro and then carry out the open and copy stop th
macro and have a look at the code. Expect to replace the "selection
object with a range object which you will need to declare eg DI
myRange as range.

put a button on the the spreadsheet use a normal drawing object. righ
click on it and assign macro.

I might catch up later to see how you got on

regard

--
tony
-----------------------------------------------------------------------
tony h's Profile: http://www.excelforum.com/member.php...fo&userid=2107
View this thread: http://www.excelforum.com/showthread.php?threadid=52304

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro/VBA help - lots of xls imports


Thanks to both of you - my spreadsheet is now up and running


--
Steve M
------------------------------------------------------------------------
Steve M's Profile: http://www.excelforum.com/member.php...o&userid=32520
View this thread: http://www.excelforum.com/showthread...hreadid=523047

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
truncation with imports via html jvblue Excel Worksheet Functions 0 September 23rd 08 10:03 PM
Data Imports incorrectly Mike H Excel Discussion (Misc queries) 1 August 1st 07 11:42 AM
Imports No Name Excel Programming 0 May 5th 04 04:04 PM
Lots of Frustration - Lots of Arrays, Dynamic Ranges Don't Work, Help With Options Karl Burrows Excel Programming 4 April 17th 04 12:48 PM
How to build build a macro that automatically imports PedroPeso Excel Programming 1 December 26th 03 08:14 PM


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