+ Reply to Thread
Results 1 to 4 of 4

VBA - Clear content cell with font name

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-01-2017
    Location
    Santos
    MS-Off Ver
    Office 2016 - Windows 7
    Posts
    105

    Question VBA - Clear content cell with font name

    Dears good morning

    I am trying to find a way to delete content of cells where the font name used is "Calibri.
    I tried different ways but unfortunately untill nopw, nothing worked.

    May I kindly ask you, if someone can help me ?

    Columns I need to check are "C" and "D"
    I tried the following code but it did not work.

            lastRow = Cells(Rows.Count, 1).End(xlUp).Row
    For i = 1 To lastRow
        If Cell.Font.Name = "Calibri" Then
                Cell.ClearContents
        End If
    Next i
    I do not know if I was on the good "path".
    If someone can help me I will be gratefull

    Waiting for feedback
    Regards

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: VBA - Clear content cell with font name

    Perhaps
        If Cells(i, 1).Font.Name = "Calibri" Then
                Cells(i,1).ClearContents
        End If

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,530

    Re: VBA - Clear content cell with font name

    For column c.

    For i = 1 To lastRow
        If Cells(i, 3).Font.Name = "Calibri" Then
            Cells(i, 3).ClearContents
        End If
    Next i
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Forum Contributor
    Join Date
    06-01-2017
    Location
    Santos
    MS-Off Ver
    Office 2016 - Windows 7
    Posts
    105

    Re: VBA - Clear content cell with font name

    Quote Originally Posted by bakerman2 View Post
    For column c.

    For i = 1 To lastRow
        If Cells(i, 3).Font.Name = "Calibri" Then
            Cells(i, 3).ClearContents
        End If
    Next i
    Yes yes yes !!!

    It works

    Thank you guys for your help Bakerman2 & jindon

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Clear Content When a cell value = 0
    By Captain Hook in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-22-2017, 01:06 PM
  2. [SOLVED] Clear content referencing another cell's same content
    By papusale in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-08-2015, 05:21 AM
  3. How to clear cell's content?
    By NZL in forum Excel General
    Replies: 3
    Last Post: 03-09-2013, 10:04 AM
  4. Clear Cell Content Query
    By captedgar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-23-2010, 06:25 AM
  5. Deleting cell no value by clear Content
    By pichai in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-24-2008, 07:53 AM
  6. clear the content inside the cell
    By silverskye787 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-01-2007, 11:11 AM
  7. Clear content of cell if has some character.
    By Krzys in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-23-2007, 09:20 PM

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