-
[VBA]Sub formatting_teddy()
Dim cell As Range
Dim lookup As Range
Dim firstaddress As String
'every cell in B2:BX - X
For Each cell In Worksheets(1).Range("B2", Range("B2").End(xlDown).Offset(-1, 0))
'This is the list with descriptions
With Worksheets(2).Range("C1:C9")
'Lookup number of description
Set lookup = .Find(cell, LookIn:=xlValues)
'In sheets(2) or for you the businessreports
'1 in column C - Teddy I in column D
'2 in column C - Another description in D
'...
'9
'If 1 we color the cell
If Not lookup Is Nothing And lookup = 1 Then
firstaddress = lookup.Address
Do
cell.Interior.ColorIndex = 8
Set lookup = .FindNext(lookup)
Loop While Not lookup Is Nothing And lookup.Address <> firstaddress
End If
End With
Next cell
End Sub[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules