Consulting

Results 1 to 2 of 2

Thread: Make Cell Blink 3 times

  1. #1

    Make Cell Blink 3 times

    Can someone add to this code so the cell will only blink a set number of times?
    Thanks???

    Option Explicit
    
    Dim bCellCheck As Boolean
    Dim bBlink As Boolean
    
    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    Dim rColumn As Range
    Dim sAdress As String
    
    On Error GoTo ErrorHandle
        
    If Not IsEmpty(Range("G4")) Then
            Set rColumn = Range("G4")
       End If
    
    bCellCheck = False
    
       If Range("I5").Value < (8) Then
             bCellCheck = True
             If Len(sAdress) > 0 Then
         sAdress = sAdress & "," & rColumn.Address
             Else
         sAdress = sAdress & rColumn.Address
             End If
       End If
    
    If bCellCheck = True And bBlink = False Then
       Set rRange = Range(sAdress)
          bBlink = True
       StartBlink
    ElseIf bCellCheck = True And bBlink = True Then
       Set rRange = rColumn
          StopBlink
       Set rRange = Range(sAdress)
          StartBlink
    ElseIf bCellCheck = False And bBlink = True Then
          Set rRange = rColumn
          StopBlink
          bBlink = False
    End If
    
    Exit Sub
    ErrorHandle:
       MsgBox Err.Description & " Procedure Worksheet_Change."
       Set rRange = Nothing
       Set rColumn = Nothing
       bCellCheck = False
    End Sub
    Last edited by SamT; 05-06-2018 at 11:10 PM. Reason: Formatted White space, Added Code Formatting Tags with # Icon

  2. #2
    You did not include the code for StartBlink & StopBlink, but from what I can see by the variables you've used and the structure of your Worksheet_Change code , it looks like your code is based on this example:

    http://sitestory.dk/excel_vba/blinking-cells.htm

    or something very similar. If so, then the attached mods to StartBlink & StopBlink might be a starting point for what you want to do. The number of blinks is controlled by setting the variable BlinkMax.


    Attached Files Attached Files

Posting Permissions

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