Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Font to Bold based on data in a range

Status
Not open for further replies.
Mar 23, 2004
4
0
0
US
I created the following code and need some assistance adding the below functionality.

For any applications listed in the RevisedAppList tab that are not listed under the CertifiedApps tab, the font should change to Bold BLUE. Not sure how to write this out.

Sub AddNewThree()


Dim iListCount As Integer
Dim iCtr As Integer
Dim oRng

' Turn off screen updating to speed up macro.
Application.ScreenUpdating = False

' Get count of records to search through (list that will be deleted).
iListCount = Sheets("RevisedAppList").Cells(Rows.Count, "A").End(xlUp).Row

' Loop through the "master" list.
For Each x In Sheets("CoreAppList").Range("A1:A" & Sheets("CoreAppList").Cells(Rows.Count, "A").End(xlUp).Row)
' Loop through all records in the second list.
For iCtr = iListCount To 2 Step -1
' Do comparison of next record.
' To specify a different column, change 1 to the column number.
If x.Value = Sheets("RevisedAppList").Cells(iCtr, 1).Value Then
' If match is true then delete row.
Sheets("RevisedAppList").Cells(iCtr, 1).EntireRow.Delete
End If
Next iCtr
Next
Application.ScreenUpdating = True
'MsgBox "Core Applications have been removed have a nice day!"

'Added by Hitesh
iListCount = 0
iCtr = 0

' Turn off screen updating to speed up macro.
Application.ScreenUpdating = False

' Get count of records to search through (list that will be deleted).
iListCount = Sheets("RevisedAppList").Cells(Rows.Count, "A").End(xlUp).Row

' Loop through the "master" list.
For Each x In Sheets("CertifiedApps").Range("A1:A" & Sheets("CertifiedApps").Cells(Rows.Count, "A").End(xlUp).Row)
' Loop through all records in the second list.
For iCtr = iListCount To 2 Step -1
' Do comparison of next record.
' To specify a different column, change 1 to the column number.
If x.Value = Sheets("RevisedAppList").Cells(iCtr, 1).Value Then
' If match is true then delete row.
Sheets("RevisedAppList").Cells(iCtr, 1).EntireRow.Delete
End If
Next iCtr
Next
Application.ScreenUpdating = True
'MsgBox "Certified Applications have been removed have a nice day!"

'Now highlight the apps that require admin rights
'Added by Hitesh
iListCount = 0
iCtr = 0

' Turn off screen updating to speed up macro.
Application.ScreenUpdating = False

' Get count of records to search through (list that will be deleted).
iListCount = Sheets("RevisedAppList").Cells(Rows.Count, "A").End(xlUp).Row

' Loop through the "master" list.
For Each x In Sheets("Admin").Range("A1:A" & Sheets("Admin").Cells(Rows.Count, "A").End(xlUp).Row)
' Loop through all records in the second list.
For iCtr = iListCount To 2 Step -1
' Do comparison of next record.
' To specify a different column, change 1 to the column number.
If x.Value = Sheets("RevisedAppList").Cells(iCtr, 1).Value Then
' If match is true then delete row.
'Sheets("RevisedAppList").Cells(iCtr, 1).EntireRow.Delete
Sheets("RevisedAppList").Cells(iCtr, 1).Font.Color = RGB(255, 0, 0)
End If
Next iCtr
Next
Application.ScreenUpdating = True
MsgBox "Core Applications and Certified applications have been removed!"
MsgBox "Applications requiring admin rights have been marked in RED!"
MsgBox "Applications requiring admin rights have been marked in BLUE!"
End Sub

Thanks,

Tom


 
With Sheets("RevisedAppList").Cells(iCtr, 1).Font
.Color = vbBlue
.FontStyle = "Bold"
End With

Check the VB library in the Object Browser for color constants. vbRed is in there as well.
 
Looking at my existing code where specifically should I place the code you provided. I'm new to VBA so I'm slowly learning where things go.

Thanks,

Tom
 
Wherever you were going to use the RGB call. The last two message boxes are confusing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top