letting user select spreadsheet
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Letting the User Select a spreadsheet to copy from

Letting the User Select a spreadsheet to copy from

resolvedResolved · Low Priority · Version 2007

replyReply Wed 18 May 2011, 15:46Delegate Joe said...

Joe has attended:
Excel VBA Intro Intermediate course

Letting the User Select a spreadsheet to copy from

Is there some simple code, where by a user is prompted to select a file where the data contained can be copied into the main file, and then close the file they chose, allowing them to retunr to the main document to work on the copied data?

For upcoming training course dates see: Pricing & availability

replyReply Mon 23 May 2011, 13:18Trainer Anthony said...

RE: Letting the User Select a spreadsheet to copy from

Hi Joe, thanks for your query. There's no one line of code to do all that, as it involves several different procedures. First you need to capture the name of the file the user is interested in. Here's a useful walkthough of how to activate and gather information using the Excel dialog boxes.

http://www.ozgrid.com/VBA/ExcelsDialogBoxes.htm

Once you've got the filename, it's up to you how you want to code the rest. Perhaps code the opening of the file, the display of a userform with the Ref.Edit control allowing the user to select and OK a range of their choice, then the closure of that file, returning the user to the original file and allowing them to paste in the data. That's "all" there is to it!

Hope this helps,

Anthony

Mon 30 May 2011: Automatically marked as resolved.

 

Please browse our web site to find out more about
excel vba courses and other Microsoft training courses.

Excel tip:

Convert Text to Columns in Excel 2010

If you have a cell in your Excel spreadsheet that contains a lot of text and you want to divide it into separate columns, this can only be done if there is a logical character which separates the text, for example, a comma.

Select the cells you would like to convert. On the Data tab, click Text to Columns. Choose the format of your current data.

Select Delimited if the text contains a logical character otherwise select Fixed Width if there are a certain number of spaces between each field.

Click Next when a preview of the data appears. Then select the type of character that separates the various fields. If the character is not listed, select Other and enter the character.

Click Next again and then choose the format for each of the columns. Select the column heading in the Data preview and then select a data type from the Column data format options.

Click Finish and the text will appear in several columns.

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard