Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am having problems with the code below. What I am trying to get it to do
is if the data in any of the cells of column I says €śFollow Up Immediately€ť, €śFollow Up in 1 Day€ť, or €śFollow Up in 2 Days€ť then copy the data in cells A:D of that row into the next blank row of another sheet called €śupcoming follow-ups€ť. There are two problems with the code in its current form. The first problem is that it will only copy the data in column A. The second problem is that when I run the macro I can see it performing the first IF statement correctly (expect for only copying column A) however when it starts the second and then the third IF statement it doesnt put them in the next empty row. Instead it starts at row 2 and overwrites what the previous IF statement did. Any suggestion on how to modify this code would be greatly appreciated. --Bob Sub guided_copy_to_followup() lastrow = Cells(Rows.Count, 1).End(xlUp).Row b = 2 c = 2 d = 2 For a = 1 To lastrow If Cells(a, 9) = "Follow Up Immediately" _ Then Range("A" & a).Copy Sheets("upcoming follow-ups").Range("A" & b) b = b + 1 End If If Cells(a, 9) = "Follow Up in 1 Day" _ Then Range("A" & a).Copy Sheets("upcoming follow-ups").Range("A" & c) c = c + 1 End If If Cells(a, 9) = "Follow Up in 2 Days" _ Then Range("A" & a).Copy Sheets("upcoming follow-ups").Range("A" & d) d = d + 1 End If Next a End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copying rows with specific criteria | Excel Discussion (Misc queries) | |||
Copying Data from one sheet to another sheet on a specific day | Excel Worksheet Functions | |||
Copying specific cells from a sheet to another | Excel Discussion (Misc queries) | |||
Copying Specific Values From Sheet | Excel Discussion (Misc queries) | |||
Copying specific rows from one sheet to another | Excel Programming |