Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro question
I would like to know if a macro can accomplish the following: I have a large
worksheet with about 600 employees, and each employee has at least 1 row for each date of the month. For each employee, I would like to search in Column C for one of 2 different values (RSV, NEW). If that value is found in ANY row for that employee, it will copy all values in column C (for that employee) to the corresponding row in column D. Please see first reply for an example. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro question
You could use a FINDNEXT macro(look in the vba help for FINDNEXT) to do just
that -- Don Guillett Microsoft MVP Excel SalesAid Software "richzip" wrote in message ... I would like to know if a macro can accomplish the following: I have a large worksheet with about 600 employees, and each employee has at least 1 row for each date of the month. For each employee, I would like to search in Column C for one of 2 different values (RSV, NEW). If that value is found in ANY row for that employee, it will copy all values in column C (for that employee) to the corresponding row in column D. Please see first reply for an example. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro question
Try this code. It uses Sumproduct on the worksheet
Sub copycolumn() OldEmployee = 0 RowCount = 1 Start = RowCount CopyCol = False Do While Range("A" & RowCount) < "" If Range("A" & RowCount) < Range("A" & (RowCount + 1)) Then Employee = Range("A" & RowCount) ColARange = "A" & Start & ":A" & RowCount ColCRange = "C" & Start & ":C" & RowCount RSVSumProduct = "Sumproduct(--(" & ColARange & "=" & Employee & ")," & _ "--(" & ColCRange & "=""RSV""))" RSVResult = Evaluate(RSVSumProduct) NewSumProduct = "Sumproduct(--(" & ColARange & "=" & Employee & ")," & _ "--(" & ColCRange & "=""NEW""))" NewResult = Evaluate(NewSumProduct) Result = RSVResult + NewResult If Result 0 Then Range(ColCRange).Copy Destination:=Range("D" & Start) End If Start = RowCount + 1 End If RowCount = RowCount + 1 Loop End Sub "Don Guillett" wrote: You could use a FINDNEXT macro(look in the vba help for FINDNEXT) to do just that -- Don Guillett Microsoft MVP Excel SalesAid Software "richzip" wrote in message ... I would like to know if a macro can accomplish the following: I have a large worksheet with about 600 employees, and each employee has at least 1 row for each date of the month. For each employee, I would like to search in Column C for one of 2 different values (RSV, NEW). If that value is found in ANY row for that employee, it will copy all values in column C (for that employee) to the corresponding row in column D. Please see first reply for an example. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Yet another macro question | Excel Discussion (Misc queries) | |||
Excel 2007 Macro/VB Question DDE Question | Excel Worksheet Functions | |||
Macro If Then Question | Excel Programming | |||
Macro Question | Excel Discussion (Misc queries) | |||
macro question | Excel Programming |