Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
help creating a macro
Hi there,
i already have a macro which grabs required date from a folder on my machine, and places it into a spreadsheet called mydata, it also sorts the list etc. what i would like to do know is to open another document and run a macro to grab data from mydata and place it into specific fields in a doc called statement. i can work the logic out of the macro but do not know where to start. my thoughts on the macro are as follows open the document called 'mydata' from the following directory d:\data\mydata check column 'A3' and if name contains 'sam' then do the following: (B3 is the forst cell to contain useful data) copy data from Cell 'E3' and place it into A24 copy data from Cell 'F3' and place it into B24 copy data from Cell 'G3' and place it into E24 when it has done the first lot of data then it checks the next cell A4 and if it contains the same name then it will do the following copy data from Cell 'E4' and place it into A24 copy data from Cell 'F4' and place it into B24 copy data from Cell 'G4' and place it into E24 then it will check A5 etc until cell 'Ax' doesn't contain the required data. does this make sense to anyone?, if so any advice would be useful. Regards Scott |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
help creating a macro
Hi Scott
here is a litle program which should wor public sub pouyou( Dim k as intege ChDir "d:\data Workbooks.Open Filename:="d:\data\mydata for k = 3 to 2 if Cells(k,1).value = "sam" the range(Cells(k,5),Cells(k,6)).cop Cells(24,1).selec activesheet.past Cells(k,7).cop Cells(24,5).selec activesheet.past else: exit fo end i next end su I have use k from 3 to 23 because you say that the first data was in A3 and because you are pasting all your data in A24.. But if you went more, you just have to change the number Best regards Benjami |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Creating macro | Excel Worksheet Functions | |||
VBA and creating a Macro | Excel Discussion (Misc queries) | |||
Help with creating a Macro | Excel Discussion (Misc queries) | |||
Creating a Macro? V2 | Excel Discussion (Misc queries) | |||
Creating a Macro? | Excel Discussion (Misc queries) |