View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ben.c ben.c is offline
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