Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-29-2013, 03:24 AM
tomlam tomlam is offline how to copy some information from one excel file to another excel file Windows 7 64bit how to copy some information from one excel file to another excel file Office 2007
Advanced Beginner
how to copy some information from one excel file to another excel file
 
Join Date: Oct 2012
Posts: 33
tomlam is on a distinguished road
Default how to copy some information from one excel file to another excel file

Dear Sir



We would like to make a small programme which
copy some details from named "products details" file
into named "breakdown" file, the result will be as
named "breakdown-result" file

we will copy as follow steps

for "products details" file
for mark no : r1, we will copy the details from "products details" and paste into sheet 1 in breakdown file

for mark no: r2, we will copy the details from "products details" and paste into sheet 2 in breakdown file

that is
r1 paste to sheet 1 in breakdown file
r2 paste to sheet 2 in breakdown file

Then the result will be as name "breakdown-result" file

when we open the file "breakdown","products details" file,
how to write the the VBA code, then programe will automatically
copy and paste

sub a()

"HOW TO WRITE THE VBA CODE"

end sub

Thanks
Tom
Attached Files
File Type: xls breakdown.xls (19.0 KB, 7 views)
File Type: xls breakdown-result.xls (20.0 KB, 6 views)
File Type: xls products details.xls (17.5 KB, 8 views)
Reply With Quote
  #2  
Old 07-29-2013, 06:29 PM
BobBridges's Avatar
BobBridges BobBridges is offline how to copy some information from one excel file to another excel file Windows 7 64bit how to copy some information from one excel file to another excel file Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

Seems to me the best way to start, if you don't already know VBA, is to start recording a macro; then do all the actions you want included, while the recording mechanism "watches". When you're done, stop recording, and look at the macro that Excel created. You'll have to modify it from there to make it more general; we'll have to talk about that.

I expect you'll have questions. Do you know how to record a macro? Once you've recorded a macro, do you know how to find and display it? And once you're looking at the macro instructions, do you have any programming background that will help you understand how it works?
Reply With Quote
  #3  
Old 08-04-2013, 06:44 PM
tomlam tomlam is offline how to copy some information from one excel file to another excel file Windows 7 64bit how to copy some information from one excel file to another excel file Office 2007
Advanced Beginner
how to copy some information from one excel file to another excel file
 
Join Date: Oct 2012
Posts: 33
tomlam is on a distinguished road
Default

Hi thanks for your help
but if the mark no , no of r1,r2 is different from time to time

for example
r1
r1
r2
r2
r2

next time is
r1
r1
r1
r1
r2

Then the macro recording cannot use.
then how to write the vba code ....maybe use if ...then...

Thanks
Tom
Reply With Quote
  #4  
Old 08-04-2013, 08:18 PM
BobBridges's Avatar
BobBridges BobBridges is offline how to copy some information from one excel file to another excel file Windows 7 64bit how to copy some information from one excel file to another excel file Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

Correct. I would do it that way: Record the macro for just one set of cells. Then you can look at that program, and learn from it how those VBA commands should be written. With a little work (and I'll help), you should then be able to write IF statements that will enable your program to know how to do the same thing for the right cells next time.
Reply With Quote
  #5  
Old 10-01-2013, 03:06 PM
macropod's Avatar
macropod macropod is offline how to copy some information from one excel file to another excel file Windows 7 32bit how to copy some information from one excel file to another excel file Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by tomlam View Post
Dear Sir

We would like to make a small programme which
copy some details from named "products details" file
into named "breakdown" file, the result will be as
named "breakdown-result" file

we will copy as follow steps

for "products details" file
for mark no : r1, we will copy the details from "products details" and paste into sheet 1 in breakdown file

for mark no: r2, we will copy the details from "products details" and paste into sheet 2 in breakdown file
Hi Tom,

Contrary to previous advice, the macro recorder will be of little use here and, even if it was, the code it produces tends to be very inefficient.

I've had a look at your "products details" file and have some questions: Are the data always sorted by r1, r2, etc? Since your breakdown file is empty, except for having nine worksheets, is there a reason you need to work with that rather than, say, creating a new workbook on the fly and adding worksheets as necessary?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to copy some information from one excel file to another excel file excel cannot open the file .xlsx because the file format or file extension is not val teddysika Excel 1 11-22-2012 06:06 AM
excel file tahseen Excel 1 12-11-2011 01:55 AM
how to copy some information from one excel file to another excel file How to copy automatically data from Excel file to Word file? fuchsd Word 6 10-25-2011 05:52 AM
how to copy some information from one excel file to another excel file Help with Excel file cjv4life Excel 2 01-24-2011 12:53 PM
Help! Find text in doc file & copy to another file northstarman Word 1 11-05-2010 08:15 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:44 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft