Note: The other languages of the website are Google-translated. Back to English
登陆  \/ 
x
or
x
注册  \/ 
x

or

如何在Excel中闪烁或闪烁指定单元格的文本?

为了使某个单元格在工作表中突出显示,如何使该单元格的文本闪烁? 本文将向您展示使Excel中指定单元格的文本闪烁的方法。

用VBA代码闪烁或闪烁指定单元格的文本


用VBA代码闪烁或闪烁指定单元格的文本

请执行以下操作以闪烁Excel中指定单元格的文本。

1。 按 其他 + F11 同时打开 Microsoft Visual Basic应用程序 窗口。

2。 在里面 Microsoft Visual Basic应用程序 窗口中,单击 插页 > 模块。 然后将以下代码复制并粘贴到“代码”窗口中。

VBA代码:在Excel中闪烁指定单元格的文本

Sub StartBlink()
'Updated by ExtendOffice 20181010
    Dim xCell As Range
    Dim xTime As Variant
      On Error Resume Next
    Set xCell = Range("Sheet2!A1")
  On Error Resume Next
   
        If xCell.Font.Color = vbRed Then
            xCell.Font.Color = vbWhite
        Else
            xCell.Font.Color = vbRed
        End If
    xTime = Now + TimeSerial(0, 0, 1)
    Application.OnTime xTime, "'" & ThisWorkbook.Name & "'!StartBlink", , True
End Sub

备注:在此VBA代码中,Sheet2和A1表示Sheet1单元格A2中的文本在当前工作簿中将闪烁。

3。 按 其他 + Q 同时关闭按键 Microsoft Visual Basic应用程序 窗口。

现在,您需要一个按钮来开始和停止闪烁。

4。 点击 开发商 > 插页 > 按钮(表单控件)。 看截图:

5.在工作表中绘制一个按钮,然后 分配宏 弹出对话框,请点击 开始闪烁 姓名 框,然后单击 OK 按钮。 看截图:

6.右键单击插入的按钮,然后单击 编辑文字 从右键单击菜单中。 然后将按钮文本更改为所需的文本,例如“开始/停止闪烁”。

从现在开始,单击按钮时,单元格A1的文本开始闪烁。 当再次单击该按钮时,单元格A1的文本停止闪烁。


最佳办公效率工具

Kutools for Excel解决了您的大多数问题,并使您的生产率提高了80%

  • 重用: 快速插入 复杂的公式,图表 以及您以前使用过的任何东西; 加密单元 带密码 创建邮件列表 并发送电子邮件...
  • 超级公式栏 (轻松编辑多行文本和公式); 阅读版式 (轻松读取和编辑大量单元格); 粘贴到过滤范围...
  • 合并单元格/行/列 不会丢失数据; 拆分单元格内容; 合并重复的行/列...防止细胞重复; 比较范围...
  • 选择重复或唯一 行; 选择空白行 (所有单元格都是空的); 超级查找和模糊查找 在许多工作簿中; 随机选择...
  • 确切的副本 多个单元格,无需更改公式参考; 自动创建参考 到多张纸; 插入项目符号,复选框等...
  • 提取文字,添加文本,按位置删除, 删除空间; 创建和打印分页小计; 在单元格内容和注释之间转换...
  • 超级滤镜 (将过滤方案保存并应用于其他工作表); 高级排序 按月/周/日,频率及更多; 特殊过滤器 用粗体,斜体...
  • 结合工作簿和工作表; 根据关键列合并表; 将数据分割成多个工作表; 批量转换xls,xlsx和PDF...
  • 超过300种强大功能。 支持Office / Excel 2007-2019和365。支持所有语言。 在您的企业或组织中轻松部署。 完整功能30天免费试用。 60天退款保证。
kte选项卡201905

Office选项卡为Office带来了选项卡式界面,使您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
officetab底部
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    shalim · 7 months ago
    how to make flashing specific cell containing specific Text only ?

  • To post as a guest, your comment is unpublished.
    connie · 1 years ago
    not working,

    Please help
  • To post as a guest, your comment is unpublished.
    Shreenivas AK · 1 years ago
    when protect the sheet this code not working
  • To post as a guest, your comment is unpublished.
    mekka · 2 years ago
    hi, i need help in google sheets..

    I need an entire row to blink if F3:F1001 contains the "STAT". the entire row should be in orange but also blinking until the the column W3:W1001's checkbox is ticked.

    is it possible? can you help? pleaseeeeeeeeeeeeeee
    • To post as a guest, your comment is unpublished.
      crystal · 2 years ago
      Hi mekka,
      Sorry can't help you with that. Thank you for your comment.
  • To post as a guest, your comment is unpublished.
    baburaj.sasco@gmail.com · 2 years ago
    How can I put a condition to blink certain cells if its value is below a limit, say below 30, without using the button. Also, i will be using a protected sheet. Thanks in advance for your help.
  • To post as a guest, your comment is unpublished.
    Sam · 2 years ago
    How do i change this to sheet 1?
    • To post as a guest, your comment is unpublished.
      crystal · 2 years ago
      Hi Sam,
      If you want to make cell A1 in Sheet1 or other specific worksheet blinking, please add "Sheet1!" or other worksheet name before the cell address. See the below code line:

      Set xCell = Range("Sheet1!A1")
  • To post as a guest, your comment is unpublished.
    SUNARYANTO · 2 years ago
    MANTEB GAN
  • To post as a guest, your comment is unpublished.
    alassail.survey@gmail.com · 3 years ago
    Working. good
    But after protecting my sheet LOCK & Hidden ( except blinking cell ) it's not working.
    Anyone plz help me solve this issue.
  • To post as a guest, your comment is unpublished.
    Rashid Imam · 3 years ago
    Hi,
    it's working well but when I am protecting my sheet then blinking is not working showing debug msg.
    • To post as a guest, your comment is unpublished.
      crystal · 2 years ago
      Good day,
      Please try the following code.

      Sub StartBlink()
      Dim xCell As Range
      Dim xTime As Variant
      On Error Resume Next
      Set xCell = Range("A1")
      On Error Resume Next

      If xCell.Font.Color = vbRed Then
      xCell.Font.Color = vbWhite
      Else
      xCell.Font.Color = vbRed
      End If
      xTime = Now + TimeSerial(0, 0, 1)
      Application.OnTime xTime, "'" & ThisWorkbook.Name & "'!StartBlink", , True
      End Sub
  • To post as a guest, your comment is unpublished.
    Dayle · 3 years ago
    How do I include this code in the following so I don't need buttons but the blinking starts automatically on the workbook opening?

    Private Sub Workbook_Open()

    ' code here

    End Sub
    • To post as a guest, your comment is unpublished.
      crystal · 3 years ago
      Hi Dayle,
      Please put this code into the ThisWorkbook window.

      'Put in“ThisWorkbook”window
      Private Sub Workbook_Open()
      StarBlink
      End Sub

      Put the below code into the Module window. And then save the workbook as an Excel Macro-enabled Workbook. Hope I can help. Thanks for your comment.

      'Start blinking
      Sub StarBlink()
      Dim xCell As Range
      Dim xTime As Variant
      Set xCell = Range("A1")
      With ThisWorkbook.Worksheets("Sheet1").Range("A1").Font
      If xCell.Font.Color = vbRed Then
      xCell.Font.Color = vbWhite
      Else
      xCell.Font.Color = vbRed
      End If
      End With
      xTime = Now + TimeSerial(0, 0, 1)
      Application.OnTime xTime, "" & ThisWorkbook.Name & "!StarBlink", , True
      End Sub
      'Stop blinking
      Sub StopBlink()
      xTime = Now + TimeSerial(0, 0, 1)
      Application.OnTime EarliestTime:=xTime, Procedure:="" & ThisWorkbook.Name & "!StarBlink", Schedule:=False
      End Sub
  • To post as a guest, your comment is unpublished.
    Rafi · 3 years ago
    Working... Great
  • To post as a guest, your comment is unpublished.
    Hana · 4 years ago
    How can it make a random cell blink in a certain range?
  • To post as a guest, your comment is unpublished.
    Geoff Culbertson · 4 years ago
    Could this blinking text be applied to a condition. i.e. if a date is reached or is approaching on one worksheet, a cell on a cover/menu sheet flashes
  • To post as a guest, your comment is unpublished.
    Ken · 4 years ago
    This code will not stop the blinking it get stuck. What am I doing wrong?