Solved

change font color

Posted on 2011-02-20
14
900 Views
Last Modified: 2012-05-11
I have a spreadsheet to email to users for edit. When they open it,id like to default the font to calibri,blue and bold. This will let me know the cells they edit
0
Comment
Question by:zachvaldez
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
14 Comments
 
LVL 10

Expert Comment

by:cdebel
ID: 34937223
Here is a sample.  Just set your color to blue and font to Calibri in this sample, and it will work.
Add this code in "This Workbook"


Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    With Target
        .Font.Bold = True
        .Font.Underline = True
        .Font.Name = "Time New Roman"
        .Font.Color = vbRed
    End With
End Sub
0
 
LVL 10

Expert Comment

by:cdebel
ID: 34937232
I've forgot... remove the "underline" since you didn't asked for it.

So it should look like this:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    With Target
        .Font.Bold = True
        .Font.Name = "Calibri"
        .Font.Color = vbBlue
    End With
End Sub

ChangeFontColor.xlsm
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 34938154
zachvaldez,

You may want to consider setting the workbook to be "shared" with track changes enabled.  (Track changes can only be done on shared workbooks.)

Share workbook should never, in my opinion, be used to allow multiple users to edit a single workbook at the same time, but should rather only be used to enable track changes.

Patrick
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:zachvaldez
ID: 34938577
I'm developing the template using version 2000 to avoid any compatibility with the latest 2010 version. Do you think the code can be applied
0
 
LVL 10

Expert Comment

by:cdebel
ID: 34938583
The code could be applied.  I don't have the 2000 version beside me to test it, but you can give it a try.  These things are not new really.
0
 

Author Comment

by:zachvaldez
ID: 34963316
Im getting error saying the code does not run in your veriosn. I use excel 2010?
0
 
LVL 10

Expert Comment

by:cdebel
ID: 34963542
What is the error message?  I get no error message and i'm using Excel 2010.

I've noticed a little glitch.  Bold is not set because i change the font name after so these lines has to be swapped like this:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    With Target
        .Font.Name = "Calibri"
        .Font.Bold = True
        .Font.Color = vbBlue
    End With
End Sub

Open in new window


But as i said, it doesn't trigger any error.  Post your file if you need some help, because i suspect that you did something wrong.
0
 

Author Comment

by:zachvaldez
ID: 34963569
Is it possible to have this implemented without use of macro. Some users are not familiar or are overwhelmed when they see such messages as 'please enable macros.....' particularly when setting security to medium. I'd decided to do it without any macro calls. What's alternative?
0
 

Author Comment

by:zachvaldez
ID: 34963590
I  add your code in a windows 2000 exce spreadsheetl and tried to execute it in 2010.
0
 
LVL 10

Expert Comment

by:cdebel
ID: 34963617
Try mathewpatrick solution.  It will tell you which cells have been modified... without VBA
0
 

Author Comment

by:zachvaldez
ID: 34963749
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    With Target
        .Font.Name = "Calibri"
        .Font.Bold = True
        .Font.Color = vbBlue
    End With
End Sub

two things happen unexpectedly as I swapped the lines even though i executed in 2010
.. Since I use this on a blank template.. all  fonts are now blue in the dot file
.. got error  '1004' unable to set name property of font class when i entered values in cell
0
 
LVL 10

Expert Comment

by:cdebel
ID: 34963807
You never told me that you would do that on a template!   I said to put that on the specific workbook where you need to see those changes.  Of course if you do that in a template it will apply to all workbooks.  

(And it has nothing to do with the swap of lines.  The swap i asked to do is because when you typed something, it was turning BOLD, then when changing the font name on the next line, it was reseting the bold!)

Post your workbook please... i need to see what you have done.  The Font.Name is NOT a read only property.  You probably have set protection on your sheet or something like that...
0
 

Author Comment

by:zachvaldez
ID: 35014564
I set protection.
0
 
LVL 10

Accepted Solution

by:
cdebel earned 250 total points
ID: 35017514
i'm still waiting for a file sample.... but try this.  It will unprotect your sheet, modify the font, and protect it again.  

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    Sh.Unprotect "YourPassword"
    With Target
        .Font.Name = "Calibri"
        .Font.Bold = True
        .Font.Color = vbBlue
    End With
    Sh.Protect "YourPassword"
End Sub 

Open in new window



0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question