View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
fdebruin fdebruin is offline
external usenet poster
 
Posts: 1
Default macro to process rows in a selection

I am trying to create an action item list manager. The list
itself is simple but now I want a macro to derive some
statistics, for example the number of action items that are
open per person.

Given my current list, the process is as follows:
a) filter on status to get all the open items (manual)
b) select the rows I am interested in (manual)
c) run a macro that goes through the rows checking and counting
the actionees (which are kept in a column). The macro reports
in a different worksheet.

Using the web and the help function, I have come up with the
follwing. All seems to work except for the test in line 13. I
cannot get that right. I guess it has something to do with the
data type of the .value method. I mostly get a data type mismatch
error.

Note that the actionee field can contain more than one person,
so I cannot use a direct test (which didn't work either).

Does someone have advise for me on how to get this working?
Does someone have a recommendation of a text book which deals
with this kind of macro programming?


1 Dim row As Integer
2 Dim r1 As Range
3
4
5 Dim count_fdb As Integer
6
7 Set r1 = Selection
8
9 Sheets("AI Summary").Select
10 Range("A1").Select
11
12 For row = 1 To r1.Rows.Count
13 If Filter(r1.Offset(row - 1, 2).Value, "FDB") Then
14 count_fdb = count_fdb + 1
15 End If
16 Next row
17 Cells(1, 1).Value = count_fdb

--
-- Frank