-
[vba]Sub formatting_teddy()
Dim cell As Range
Dim lookup As Range
Dim firstaddress As String
'every cell in B2:BX - X / X is not in the range to be formatted
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
'looking for value of column b
If Not lookup Is Nothing Then
firstaddress = lookup.Address
Do
'if value found check for offset value
If lookup.Offset(, 1) = "Teddy I" Then
'if true then column b is bold
cell.Font.Bold = True
End If
'next search
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