How to Make this Macro work Fast?

MAlhash

New Member
Joined
Mar 26, 2023
Messages
41
Office Version
  1. 365
Platform
  1. Windows
I am trying to run this macro, it works, however, it taking too much time to work like 3 minutes.

The refresh button should hide the empty rows and show some shapes in the sheet.

see the attached code:
VBA Code:
Sub Refresh()
On Error Resume Next

Application.ScreenUpdating = False

Worksheets("Dashboard-Data").Rows.EntireRow.Hidden = False
    
ltrw = Cells(Rows.Count, "B").End(xlUp).Row

For i = 18 To ltrw
 
If Cells(i, 3).Value <> "Enter Task Name" Then
Cells(i, 2).EntireRow.Hidden = False
  
ElseIf Cells(i, 2).Value = Range("B114").Value Then
Cells(i, 2).EntireRow.Hidden = True

ElseIf Cells(i, 3).Value = "Enter Task Name" Then
Cells(i, 2).EntireRow.Hidden = True


  Else
  
    Cells.EntireRow.Hidden = False
    
     End If
     Next i
    With Sheets("Dashboard-Data")
   
    colorss = Cells(Rows.Count, "Q").End(xlUp).Row
    For c = 2 To colorss
          
      If Cells(c, 17).Value = "In Progress" And InStr(1, Cells(c, 3).Value, "Total") > 0 Then
    
      .Shapes("Rectangle: Rounded Corners 2072").Fill.ForeColor.RGB = RGB(255, 255, 175)
     'ActiveSheet.Shapes("Rectangle: Rounded Corners 2072").Line.Weight = 1
      .Shapes("Rectangle: Rounded Corners 2072").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
  
      .Shapes("Rectangle: Rounded Corners 171").Fill.ForeColor.RGB = RGB(255, 255, 175)
      .Shapes("Rectangle: Rounded Corners 171").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 179").Fill.ForeColor.RGB = RGB(255, 255, 175)
      .Shapes("Rectangle: Rounded Corners 179").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 187").Fill.ForeColor.RGB = RGB(255, 255, 175)
      .Shapes("Rectangle: Rounded Corners 187").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
     .Shapes("Rectangle: Rounded Corners 178").Fill.ForeColor.RGB = RGB(255, 255, 175)
      .Shapes("Rectangle: Rounded Corners 178").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 168").Fill.ForeColor.RGB = RGB(255, 255, 175)
      .Shapes("Rectangle: Rounded Corners 168").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2047").Fill.ForeColor.RGB = RGB(255, 255, 175)
      .Shapes("Rectangle: Rounded Corners 2047").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2048").Fill.ForeColor.RGB = RGB(255, 255, 175)
      .Shapes("Rectangle: Rounded Corners 2048").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 170").Fill.ForeColor.RGB = RGB(255, 255, 175)
      .Shapes("Rectangle: Rounded Corners 170").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 176").Fill.ForeColor.RGB = RGB(255, 255, 175)
      .Shapes("Rectangle: Rounded Corners 176").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2050").Fill.ForeColor.RGB = RGB(255, 255, 175)
      .Shapes("Rectangle: Rounded Corners 2050").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2051").Fill.ForeColor.RGB = RGB(255, 255, 175)
      .Shapes("Rectangle: Rounded Corners 2051").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2073").Fill.ForeColor.RGB = RGB(255, 255, 175)
      .Shapes("Rectangle: Rounded Corners 2073").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 184").Fill.ForeColor.RGB = RGB(255, 255, 175)
      .Shapes("Rectangle: Rounded Corners 184").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2053").Fill.ForeColor.RGB = RGB(255, 255, 175)
      .Shapes("Rectangle: Rounded Corners 2053").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2054").Fill.ForeColor.RGB = RGB(255, 255, 175)
      .Shapes("Rectangle: Rounded Corners 2054").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 190").Fill.ForeColor.RGB = RGB(255, 255, 175)
      .Shapes("Rectangle: Rounded Corners 190").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 186").Fill.ForeColor.RGB = RGB(255, 255, 175)
      .Shapes("Rectangle: Rounded Corners 186").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2052").Fill.ForeColor.RGB = RGB(255, 255, 175)
      .Shapes("Rectangle: Rounded Corners 2052").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2049").Fill.ForeColor.RGB = RGB(255, 255, 175)
      .Shapes("Rectangle: Rounded Corners 2049").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
     
      ElseIf Cells(c, 17).Value = "Completed" And InStr(1, Cells(c, 3).Value, "Total") > 0 Then
    
     
      .Shapes("Rectangle: Rounded Corners 2072").Fill.ForeColor.RGB = RGB(206, 249, 203)
      .Shapes("Rectangle: Rounded Corners 2072").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
    
      .Shapes("Rectangle: Rounded Corners 171").Fill.ForeColor.RGB = RGB(206, 249, 203)
     .Shapes("Rectangle: Rounded Corners 171").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 179").Fill.ForeColor.RGB = RGB(206, 249, 203)
      .Shapes("Rectangle: Rounded Corners 179").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 187").Fill.ForeColor.RGB = RGB(206, 249, 203)
      .Shapes("Rectangle: Rounded Corners 187").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
     .Shapes("Rectangle: Rounded Corners 178").Fill.ForeColor.RGB = RGB(206, 249, 203)
      .Shapes("Rectangle: Rounded Corners 178").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 168").Fill.ForeColor.RGB = RGB(206, 249, 203)
      .Shapes("Rectangle: Rounded Corners 168").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2047").Fill.ForeColor.RGB = RGB(206, 249, 203)
      .Shapes("Rectangle: Rounded Corners 2047").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2048").Fill.ForeColor.RGB = RGB(206, 249, 203)
      .Shapes("Rectangle: Rounded Corners 2048").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 170").Fill.ForeColor.RGB = RGB(206, 249, 203)
      .Shapes("Rectangle: Rounded Corners 170").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
     .Shapes("Rectangle: Rounded Corners 176").Fill.ForeColor.RGB = RGB(206, 249, 203)
      .Shapes("Rectangle: Rounded Corners 176").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
           
      .Shapes("Rectangle: Rounded Corners 2050").Fill.ForeColor.RGB = RGB(206, 249, 203)
      .Shapes("Rectangle: Rounded Corners 2050").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2051").Fill.ForeColor.RGB = RGB(206, 249, 203)
      .Shapes("Rectangle: Rounded Corners 2051").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2073").Fill.ForeColor.RGB = RGB(206, 249, 203)
      .Shapes("Rectangle: Rounded Corners 2073").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 184").Fill.ForeColor.RGB = RGB(206, 249, 203)
      .Shapes("Rectangle: Rounded Corners 184").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2053").Fill.ForeColor.RGB = RGB(206, 249, 203)
      .Shapes("Rectangle: Rounded Corners 2053").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2054").Fill.ForeColor.RGB = RGB(206, 249, 203)
      .Shapes("Rectangle: Rounded Corners 2054").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 190").Fill.ForeColor.RGB = RGB(206, 249, 203)
      .Shapes("Rectangle: Rounded Corners 190").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 186").Fill.ForeColor.RGB = RGB(206, 249, 203)
      .Shapes("Rectangle: Rounded Corners 186").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2052").Fill.ForeColor.RGB = RGB(206, 249, 203)
      .Shapes("Rectangle: Rounded Corners 2052").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2049").Fill.ForeColor.RGB = RGB(206, 249, 203)
      .Shapes("Rectangle: Rounded Corners 2049").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
    
    ElseIf Cells(c, 17).Value = "Pending" And InStr(1, Cells(c, 3).Value, "Total") > 0 Then
    
     
      .Shapes("Rectangle: Rounded Corners 2072").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 2072").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 171").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 171").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 179").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 179").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 187").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 187").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 178").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 178").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 168").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 168").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2047").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 2047").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2048").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 2048").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 170").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 170").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 176").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 176").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2050").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 2050").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2051").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 2051").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2073").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 2073").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 184").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 184").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2053").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 2053").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2054").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 2054").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 190").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 190").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 186").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 186").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
                 
      .Shapes("Rectangle: Rounded Corners 2052").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 2052").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
      .Shapes("Rectangle: Rounded Corners 2049").Fill.ForeColor.RGB = RGB(255, 133, 133)
      .Shapes("Rectangle: Rounded Corners 2049").TextFrame.Characters.Font.Color = RGB(34, 42, 53)
     
    Else
     
      .Shapes("Rectangle: Rounded Corners 2072").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 2072").TextFrame.Characters.Font.Color = RGB(242, 242, 242)
     
      .Shapes("Rectangle: Rounded Corners 171").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 171").TextFrame.Characters.Font.Color = RGB(242, 242, 242)
             
      .Shapes("Rectangle: Rounded Corners 179").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 179").TextFrame.Characters.Font.Color = RGB(242, 242, 242)
     
      .Shapes("Rectangle: Rounded Corners 187").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 187").TextFrame.Characters.Font.Color = RGB(242, 242, 242)
     
      .Shapes("Rectangle: Rounded Corners 178").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 178").TextFrame.Characters.Font.Color = RGB(242, 242, 242)
     
      .Shapes("Rectangle: Rounded Corners 168").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 168").TextFrame.Characters.Font.Color = RGB(242, 242, 242)
     
      .Shapes("Rectangle: Rounded Corners 2047").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 2047").TextFrame.Characters.Font.Color = RGB(242, 242, 242)
     
      .Shapes("Rectangle: Rounded Corners 2048").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 2048").TextFrame.Characters.Font.Color = RGB(242, 242, 242)
     
      .Shapes("Rectangle: Rounded Corners 170").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 170").TextFrame.Characters.Font.Color = RGB(242, 242, 242)
     
      .Shapes("Rectangle: Rounded Corners 176").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 176").TextFrame.Characters.Font.Color = RGB(242, 242, 242)
     
      .Shapes("Rectangle: Rounded Corners 2050").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 2050").TextFrame.Characters.Font.Color = RGB(242, 242, 242)

      .Shapes("Rectangle: Rounded Corners 2051").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 2051").TextFrame.Characters.Font.Color = RGB(242, 242, 242)
     
      .Shapes("Rectangle: Rounded Corners 2073").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 2073").TextFrame.Characters.Font.Color = RGB(242, 242, 242)
     
      .Shapes("Rectangle: Rounded Corners 184").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 184").TextFrame.Characters.Font.Color = RGB(242, 242, 242)
     
      .Shapes("Rectangle: Rounded Corners 2053").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 2053").TextFrame.Characters.Font.Color = RGB(242, 242, 242)
     
      .Shapes("Rectangle: Rounded Corners 2054").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 2054").TextFrame.Characters.Font.Color = RGB(242, 242, 242)
     
      .Shapes("Rectangle: Rounded Corners 190").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 190").TextFrame.Characters.Font.Color = RGB(242, 242, 242)
     
      .Shapes("Rectangle: Rounded Corners 186").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 186").TextFrame.Characters.Font.Color = RGB(242, 242, 242)
     
      .Shapes("Rectangle: Rounded Corners 2052").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 2052").TextFrame.Characters.Font.Color = RGB(242, 242, 242)
     
      .Shapes("Rectangle: Rounded Corners 2049").Fill.ForeColor.RGB = RGB(34, 42, 53)
      .Shapes("Rectangle: Rounded Corners 2049").TextFrame.Characters.Font.Color = RGB(242, 242, 242)

End If
Next c
  
  
If .Shapes("Rectangle: Rounded Corners 2072").TextFrame.Characters.Text = "Project 1" Then
.Shapes("Rectangle: Rounded Corners 2072").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 2072").Visible = True
End If


If .Shapes("Rectangle: Rounded Corners 171").TextFrame.Characters.Text = "Project 2" Then
.Shapes("Rectangle: Rounded Corners 171").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 171").Visible = True
End If

If .Shapes("Rectangle: Rounded Corners 179").TextFrame.Characters.Text = "Project 3" Then
.Shapes("Rectangle: Rounded Corners 179").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 179").Visible = True
End If

If .Shapes("Rectangle: Rounded Corners 187").TextFrame.Characters.Text = "Project 4" Then
.Shapes("Rectangle: Rounded Corners 187").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 187").Visible = True
End If

If .Shapes("Rectangle: Rounded Corners 178").TextFrame.Characters.Text = "Project 5" Then
.Shapes("Rectangle: Rounded Corners 178").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 178").Visible = True
End If

If .Shapes("Rectangle: Rounded Corners 168").TextFrame.Characters.Text = "Project 6" Then
.Shapes("Rectangle: Rounded Corners 168").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 168").Visible = True
End If

If .Shapes("Rectangle: Rounded Corners 2047").TextFrame.Characters.Text = "Project 7" Then
.Shapes("Rectangle: Rounded Corners 2047").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 2047").Visible = True
End If

If .Shapes("Rectangle: Rounded Corners 2048").TextFrame.Characters.Text = "Project 8" Then
.Shapes("Rectangle: Rounded Corners 2048").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 2048").Visible = True
End If

If .Shapes("Rectangle: Rounded Corners 170").TextFrame.Characters.Text = "Project 9" Then
.Shapes("Rectangle: Rounded Corners 170").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 170").Visible = True
End If

If .Shapes("Rectangle: Rounded Corners 176").TextFrame.Characters.Text = "Project 10" Then
.Shapes("Rectangle: Rounded Corners 176").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 176").Visible = True
End If

If .Shapes("Rectangle: Rounded Corners 2050").TextFrame.Characters.Text = "Project 11" Then
.Shapes("Rectangle: Rounded Corners 2050").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 2050").Visible = True
End If

If .Shapes("Rectangle: Rounded Corners 2051").TextFrame.Characters.Text = "Project 12" Then
.Shapes("Rectangle: Rounded Corners 2051").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 2051").Visible = True
End If

If .Shapes("Rectangle: Rounded Corners 2073").TextFrame.Characters.Text = "Project 13" Then
.Shapes("Rectangle: Rounded Corners 2073").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 2073").Visible = True
End If

If .Shapes("Rectangle: Rounded Corners 184").TextFrame.Characters.Text = "Project 14" Then
.Shapes("Rectangle: Rounded Corners 184").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 184").Visible = True
End If

If .Shapes("Rectangle: Rounded Corners 2053").TextFrame.Characters.Text = "Project 15" Then
.Shapes("Rectangle: Rounded Corners 2053").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 2053").Visible = True
End If

If .Shapes("Rectangle: Rounded Corners 2054").TextFrame.Characters.Text = "Project 16" Then
.Shapes("Rectangle: Rounded Corners 2054").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 2054").Visible = True
End If

If .Shapes("Rectangle: Rounded Corners 190").TextFrame.Characters.Text = "Project 17" Then
.Shapes("Rectangle: Rounded Corners 190").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 190").Visible = True
End If

If .Shapes("Rectangle: Rounded Corners 186").TextFrame.Characters.Text = "Project 18" Then
.Shapes("Rectangle: Rounded Corners 186").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 186").Visible = True
End If

If .Shapes("Rectangle: Rounded Corners 2052").TextFrame.Characters.Text = "Project 19" Then
.Shapes("Rectangle: Rounded Corners 2052").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 2052").Visible = True
End If

If .Shapes("Rectangle: Rounded Corners 2049").TextFrame.Characters.Text = "Project 20" Then
.Shapes("Rectangle: Rounded Corners 2049").Visible = False
Else
.Shapes("Rectangle: Rounded Corners 2049").Visible = True
End If

End With

Application.ScreenUpdating = True

End Sub
 
Last edited by a moderator:

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Try adding at the start
VBA Code:
Application.Calculation = xlManual
and at the end
VBA Code:
Application.Calculation = xlAutomatic
 
Upvote 0
This bit may help you trim down some of your shape code:
VBA Code:
    With .Shapes.Range(Array("Rounded Rectangle 1", _
                             "Rounded Rectangle 2", _
                             "Rounded Rectangle 3", _
                             "Rounded Rectangle 4"))
        .Fill.ForeColor.RGB = RGB(255, 255, 175)
        .TextFrame2.TextRange.Font.Fill.ForeColor.RGB = RGB(34, 42, 53)
    End With
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top