Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default 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
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
Creating macro Jamie Excel Worksheet Functions 9 April 6th 10 08:37 PM
VBA and creating a Macro tommy Excel Discussion (Misc queries) 4 January 28th 09 03:52 PM
Help with creating a Macro Liz J[_2_] Excel Discussion (Misc queries) 6 November 2nd 08 09:34 PM
Creating a Macro? V2 Lynda Excel Discussion (Misc queries) 5 July 22nd 08 01:06 PM
Creating a Macro? Lynda Excel Discussion (Misc queries) 2 July 21st 08 03:07 PM


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