colin,
i am posting my macro. This is not matching the components properly. please have a look at it. consider my appollo hospitals example posted earlier.
***********************************************
'assume you have the below info in sheet("Volumes as per web")
C D
Laboratories 10
Service rooms 12
Operation Theatres 15
Laboratories 11
Service rooms 13
Operation Theatres 16
'assume you have the below info in sheet("Billing Information")
C D
Laboratories ?
Service rooms ?
Operation Theatres ?
Laboratories ?
Service rooms ?
Operation Theatres ?
'you need to fill in column D
Sub CollateVolumes()
Dim Client_BIC As String
Dim TotalClients, CLS_Client_Count, ClientID, NrOfBIMs, BIMend, BIM, BIMRowNr As Long
Dim rg1, rg2 As Long
Dim rng, rng2 As Range
TotalClients = Sheets("Control Panel").Range("L2").Value
Client_Count = 1
Do Until Client_Count = TotalClients
'assume Client_BIC = "Apollo Hospitals"
Client_BIC = Sheets("Control Panel").Range("B" & Client_Count).Value
'NrOfBIMs = 105
NrOfBIMs = Sheets("Control Panel").Range("E" & Client_Count).Value
'BIMend = 109
BIMend = Sheets("Control Panel").Range("F" & Client_Count).Value
'rg1 = 136
'rg2 = 142
rg1 = Sheets("Control Panel").Range("G" & Client_Count).Value
rg2 = Sheets("Control Panel").Range("H" & Client_Count).Value
Sheets("Volumes as per web").Select
Selection.AutoFilter Field:=1, Criteria1:=Client_BIC
'here my idea is to define the range as "C136

142". Please refer to "set rng" in the next line; not sure if this is the right way to define the range. same for "set rng2" as well.
Set rng = Sheets("Volumes as per web").Range("C" & rg1, "D" & rg2)
Set rng2 = Sheets("Volumes as per web").Range("C" & rg1, "C" & rg2)
Sheets("Billing Information").Select
Selection.AutoFilter Field:=1, Criteria1:=Client_BIC
For BIMRowNr = NrOfBIMs To BIMend
'assume BIM = "Transaction Fee"
BIM = Worksheets("Billing Information").Cells(BIMRowNr, 2).Value
On Error Resume Next
If BIM = "Monthly Maintenance Fee" Then Worksheets("Billing Information").Cells(BIMRowNr, 5) = "1"
Else
'is this the right way to use Index and Match function in vba?
Worksheets("Billing Information").Cells(BIMRowNr, 5) = _
WorksheetFunction.Index(rng, WorksheetFunction.Match(BIM, rng2), 2)
On Error GoTo 0
Next
Client_Count = Client_Count + 1
Loop
End Sub