![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hello,
Can anyone help to modify this code to read/copy specific cell data from the myfile and send it or assign it to my active workbook? my active workbook will be my "master" workbook where I'll be gathering all data. The "myfile" (source files) are not in a columns and rows format, therefore I need to type specific cell references. ( the "master" file will in in a row and column format) My code open the file succesfully, but I don't know how to code for specific cells... If anyone can give me a sample of how to code it, I can follow the rest... ex : master.loan ("a1) = myfile.sheets("sheet1").cell ('b2") I am not sure about the syntax... Option Explicit Dim MyFile As String Dim MyWkBk As String Dim Directory As String Dim LstCell As String Sub GetMyData() MyWkBk = ActiveWorkbook.Name Directory = "S:\Test-Rap\" 'change this to the directory for your files MyFile = Dir(Directory & "\*.xls") Do Until MyFile = "" Workbooks.Open (Directory & MyFile) LstCell = [A1].End(xlDown).Offset(0, 3).Address Range("A2", LstCell).Copy Workbooks(MyWkBk).Activate If [A2].Value = "" Then [A2].Activate Else [A2].End(xlDown).Offset(1, 0).Activate End If ActiveCell.PasteSpecial xlPasteValues Application.CutCopyMode = False Workbooks(MyFile).Close (False) MyFile = Dir Loop ActiveWorkbook.SaveCopyAs "S:\Test-Rap\combined" 'this directory must 'exist or it will give an error End Sub |
Ads |
#2
|
|||
|
|||
![]()
Please post Excel questions in an Excel group. This is an Outlook group.
-- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "LaRana" wrote in message news ![]() Hello, Can anyone help to modify this code to read/copy specific cell data from the myfile and send it or assign it to my active workbook? my active workbook will be my "master" workbook where I'll be gathering all data. The "myfile" (source files) are not in a columns and rows format, therefore I need to type specific cell references. ( the "master" file will in in a row and column format) My code open the file succesfully, but I don't know how to code for specific cells... If anyone can give me a sample of how to code it, I can follow the rest... ex : master.loan ("a1) = myfile.sheets("sheet1").cell ('b2") I am not sure about the syntax... Option Explicit Dim MyFile As String Dim MyWkBk As String Dim Directory As String Dim LstCell As String Sub GetMyData() MyWkBk = ActiveWorkbook.Name Directory = "S:\Test-Rap\" 'change this to the directory for your files MyFile = Dir(Directory & "\*.xls") Do Until MyFile = "" Workbooks.Open (Directory & MyFile) LstCell = [A1].End(xlDown).Offset(0, 3).Address Range("A2", LstCell).Copy Workbooks(MyWkBk).Activate If [A2].Value = "" Then [A2].Activate Else [A2].End(xlDown).Offset(1, 0).Activate End If ActiveCell.PasteSpecial xlPasteValues Application.CutCopyMode = False Workbooks(MyFile).Close (False) MyFile = Dir Loop ActiveWorkbook.SaveCopyAs "S:\Test-Rap\combined" 'this directory must 'exist or it will give an error End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Plan a Meeting - unable to read data in other's blocks | DJ in KC | Outlook - Calandaring | 0 | October 18th 06 08:42 PM |
can i send one email to mailing list but with diff. attahments? | MadhavLadva | Outlook - Using Contacts | 1 | July 25th 06 01:07 PM |
Allow Outlook Appointments set in diff time zones | Kevin Tucholke, General Mills Inc | Outlook - Calandaring | 3 | June 27th 06 02:50 PM |
Pulling attachments from Contacts... | M Scott S | Outlook and VBA | 1 | May 31st 06 10:44 PM |
User receiving multiple 'Read Receipts" | kage13 | Outlook - Calandaring | 0 | January 11th 06 08:38 PM |