I need a loop that goes does column B4: B20 and finds a date and copies the data adjacent in C4: c20 until the end date in different cells
Start date is in F3, and end date in F4: In rows b are months ie: 1/1/2002, 2/1/2002 etc.
Row C consists of data (300, 200 etc).
Where I am having trouble is pasting the cell, and then continuing the loop until the other date is reached which is
Please let me know if you can help
Start date is in F3, and end date in F4: In rows b are months ie: 1/1/2002, 2/1/2002 etc.
Row C consists of data (300, 200 etc).
Code:
dim x as string, dim y as string
Dim found as boolean
'where the user puts in the start date and the loop will go and find it in rows b
x=worksheets("sheet2").range (f3")
'the end date which the user enters
y=worksheets("sheet2").range("f4")
'selecting the start of the data
Range("b5").select
'running the loop, or at least I am trying too
Do until Isempty(activecell)
If activecell.value=x then
found=true
exit do
end if
'selects the bottom cell and keeps going down to search "x"
activecell.offset(1,0).select
loop
If found=true then
'when the date is found it copies the adjacent cell
activecell.offset(0,1).copy
end if
Where I am having trouble is pasting the cell, and then continuing the loop until the other date is reached which is
("Y")-y=worksheets("s heet2").range(" f4")Please let me know if you can help
Comment