Closed Thread
Results 1 to 11 of 11

VBA - Add Font Bold

Hybrid View

  1. #1
    Registered User
    Join Date
    12-15-2007
    Posts
    30

    VBA - Add Font Bold

    Private Sub Worksheet_Change(ByVal Target As Range)
    With Target
    If .Count > 1 Then Exit Sub
    If .Column = 3 Then
    If .Value = "m/c interest" Then
    .Offset(, 2).Value = Range("L2").Value
    ElseIf .Value = "interest" Then
    .Offset(, 2).Value = Range("L3").Value
    .Offset(, -1).Value = DateSerial(Year(Now), Month(Now) + 1, 0)
    ElseIf .Value = "web internet" Then
    .Offset(, 2).Value = Range("L4").Value
    ElseIf .Value = "cell phone" Then
    .Offset(, 2).Value = Range("N2").Value
    End If
    ElseIf .Column = 5 Then
    .Offset(, -3).Value = Date
    ActiveSheet.Unprotect "r"
    Target.Locked = True
    ActiveSheet.Protect "r"
    End If
    End With
    End Sub
    this part of code font bold
    .Offset(, -1).Value = DateSerial(Year(Now), Month(Now) + 1, 0)
    Thanks
    Last edited by VBA Noob; 12-15-2007 at 05:36 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Please read the Forum Rules & wrap this code with Code tags.

    VBA Boob has done this for you.

    .Offset(, -1).Font.Bold = True
    Last edited by royUK; 12-15-2007 at 05:39 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Redd,

    Please read forum rules below and the message to cross posters then add the link to the cross post

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  4. #4
    Registered User
    Join Date
    12-15-2007
    Posts
    30
    Where does the Bold code fit ,I'am not to sure
    Last edited by Redd; 12-15-2007 at 06:04 AM.

  5. #5
    Registered User
    Join Date
    12-15-2007
    Posts
    30

    VBA interest = bold font

    Help with code
    Column 3 "interest" Font Bold
    Thanks

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Ignoring the rules won't help you get an answer. Add the link to the cross post and then someone will help you

    VBA Noob

  7. #7
    Registered User
    Join Date
    12-15-2007
    Posts
    30

    Vba Every other row shade

    A VBA to
    Data in column B
    Column A to E
    Row 2:500
    Every other row cell shaded ,colorindex=20,next row no format
    empty rows no format
    Thanks
    Last edited by Redd; 12-15-2007 at 03:21 PM.

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You don't need VBA to do this, you can achieve this with Conditional Formatting.

  9. #9
    Registered User
    Join Date
    12-15-2007
    Posts
    30
    Cond. Format used up

  10. #10
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Please read forum rules below and the message to cross posters and then add the link to the other forums

    VBA Noob

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Place this in the Worksheet code
    Option Explicit
    
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        Dim rng    As Range
        Dim R      As Long
        Dim C      As Long
    
        Set rng = ActiveSheet.UsedRange
        C = rng.Columns.Count
        For R = 3 To rng.Rows.Count
            If R Mod 2 = 0 Then Range(Cells(R, 1), Cells(R, C)).Interior.ColorIndex = 20
        Next R
    End Sub

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1