title: excel VBA how to make a floating button?
body: <p>have a code that check the date and fill cells with appropriate colors and this code includes a button that when the user clicked it will run the VBA code.</p>
  
  <p>i want to always make the button visible no matter how the user scroll down.</p>
  
  <h1>code:</h1>
  
  <pre><code>Private Sub CommandButton1_Click()
  
  Dim i As Long
  
  For i = Range("C5000").End(xlUp).Row To 2 Step -1 'Range upto 5000, chnge this as per your requirment'
  
  
      If IsEmpty(Cells(i, 3)) Then
           Cells(i, 3).Interior.Color = xlNone
  
         ElseIf (VBA.CDate(Cells(i, 3)) - VBA.Date()) &lt; 0 Then
               Cells(i, 3).Interior.Color = vbGreen
  
         ElseIf (VBA.CDate(Cells(i, 3)) - VBA.Date()) = 0 Then
               Cells(i, 3).Interior.Color = vbYellow
  
         ElseIf (VBA.CDate(Cells(i, 3)) - VBA.Date()) &gt;= 1 And (VBA.CDate(Cells(i, 3)) - VBA.Date()) &lt;= 4 Then
                Cells(i, 3).Interior.Color = vbRed
  
         ElseIf (VBA.CDate(Cells(i, 3)) - VBA.Date()) &gt;= 5 And (VBA.CDate(Cells(i, 3)) - VBA.Date()) &lt;= 10 Then
                 Cells(i, 3).Interior.Color = vbCyan
  
      Else
                  Cells(i, 3).Interior.ColorIndex = xlNone
  
   End If
  
      ' your 2nd criteria to color the entire row if "F" is not empty
      If Trim(Range("F" &amp; i).Value) &lt;&gt; "" Then Range("D" &amp; i &amp; ":F" &amp; i).Interior.ColorIndex = 15
      Debug.Print Len(Range("F" &amp; i).Value)
  
  
  Next
  End Sub
  </code></pre>
  
  <p>i will appreciate any help.</p>