Add Formatting to my procedure...or, Call another module?

Big Lar

Well-known Member
Joined
May 19, 2002
Messages
557
I use this procedure to add values to wsR from wsMembers

I’ve depleted my brain attempting to incorporate formatting of those values If conditions exist…
I’m not sure if my references are correct, but something like:
If wsMembers.Range C2.Offset(, 16).Value =< 4 Then
wsR.Range A3.Font.Italic = True

Or, if Member’s Cell S =< 4 Then
Italicize the value placed in wsR

Or, If Member’s Cell N = “” Then
Add the value in wsR AND “*”

Doable? Or, should I just write and call another module after this procedure?



Code:
Dim Cl As Range
 Dim sKey As String
  Dim wsR As Worksheet
   
   Set wsR = Sheets("R")
   Set wsMembers = Sheets("Members")
  
   With CreateObject("scripting.dictionary")
      For Each Cl In wsMembers.Range("C2", wsMembers.Range("C" & Rows.Count).End(xlUp))
         sKey = Trim(Cl.Value)
        
         If sKey <> "" Then
            .Add sKey, Cl.Offset(, 15).Value
                       
         End If
      Next Cl
  
      For Each Cl In wsR.Range("A3", wsR.Range("A" & Rows.Count).End(xlUp))
         sKey = Trim(Cl.Value)
         Cl.Offset(, 1).Value = .Item(sKey)
  End If
      Next Cl
   End With
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
How about
Code:
Sub big_lar()
   Dim Cl As Range
   Dim sKey As String
   Dim wsR As Worksheet, wsMembers As Worksheet
   
   Set wsR = Sheets("R")
   Set wsMembers = Sheets("Members")
   
   With CreateObject("scripting.dictionary")
      For Each Cl In wsMembers.Range("C2", wsMembers.Range("C" & Rows.Count).End(xlUp))
         sKey = Trim(Cl.Value)
         If sKey <> "" Then .Item(sKey) = Array(Cl.Offset(, 15).Value, Cl.Offset(, 16).Value, Cl.Offset(, 11).Value)
      Next Cl
      
      For Each Cl In wsR.Range("A3", wsR.Range("A" & Rows.Count).End(xlUp))
         sKey = Trim(Cl.Value)
         If .Item(sKey)(2) = "" Then
            Cl.Offset(, 1).Value = .Item(sKey)(0) & "*"
         Else
            Cl.Offset(, 1).Value = .Item(sKey)(0)
         End If
         If .Item(sKey)(1) <= 4 Then Cl.Offset(, 1).Font.Italic = True
      Next Cl
   End With
End Sub
 
Upvote 0
FLUFF!!!
Thank you for coming to my rescue, again!
You are a genius...(you probably already know that) :)
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0
Fluff,
How do I italicize the associated data in Cell A when:
If .Item(sKey)(1) <= 4 Then Cl.Offset(, 1).Font.Italic = True

I’ve tried adding
For Each Cl In wsRazz.Range("A2", wsRazz.Range("A" & Rows.Count).End(xlUp))
But obviously it italicizes every name in the range.

As before, suggestions are greatly appreciated.
 
Upvote 0
Simply remove the offset
Code:
If .Item(sKey)(1) <= 4 Then Cl.Font.Italic = True
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top