Results 1 to 5 of 5

Run time error 1004 - macro to change font

Threaded View

mimichan Run time error 1004 - macro... 01-16-2012, 12:28 PM
Kelshaer Re: Run time error 1004 -... 01-16-2012, 03:51 PM
mimichan Re: Run time error 1004 -... 01-17-2012, 12:27 PM
Kelshaer Re: Run time error 1004 -... 01-17-2012, 12:38 PM
mimichan Re: Run time error 1004 -... 01-17-2012, 01:21 PM
  1. #1
    Registered User
    Join Date
    01-16-2012
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    7

    Thumbs up Run time error 1004 - macro to change font

    I am a VBA beginner and need some help.

    This is an input form using Template Wizard to store the data in the database sheet.
    Half of the users of this form have Excel 2010 and half have 2003.
    Because of that environment, "WordArt" and "text box" are not showing the same (not compatible between those versions).

    What I like to do is change the font/size when a certain word is selected for the header.
    Since Conditional Format won't change the font, I had to create a macro.

    Private Sub Worksheet_Calculate()

    If Range("K19").Value = "WANTED" Then
    Range("A8:H8").Select
    With Selection.Font
    .Name = "Arial Black"
    .Size = 85
    .Bold = True
    End With

    Else
    Range("A8:H8").Select <-- error: highlight here & opens the database sheet
    With Selection.Font
    .Name = "Impact"
    .Size = 80
    .Bold = False
    End With
    End If
    End Sub

    This macro works fine to change the font but when I try to save the file, I get a message:
    "Run time error 1004 - Unable to set the name property of the font class" and the line after "Else"
    will be highlighted and the database sheet will be opened.

    I don't know what the problem is.
    Please someone help me with this.
    Last edited by mimichan; 01-17-2012 at 01:28 PM.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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