calculate sheet on a condition

Rubber Beaked Woodpecker

Board Regular
Joined
Aug 30, 2015
Messages
203
Office Version
  1. 2021
The following code works very well however I would like the sheet to only calculate when cell U1 = C

I cannot seem to get this to work correctly. Any pointers pls.

Thanks
RBW

VBA Code:
Option Explicit

Dim currentMarket As String
Private Sub Worksheet_Change(ByVal Target As Range)
Worksheets("Sheet4").Calculate
 If Target.Columns.Count = 16 Then
    Application.EnableEvents = False
 
    Range("Q2") = Range("W2")
           Range("T1") = Range("T2")
       Range("AA1") = Range("Z1")
                      If Range("S1") = 1 Then
                     
          Call Balance
                  
         
                           ElseIf Range("X2").Value = "Yes" Then
                          
               Call Results
             Call R1
                                   
        End If
   End If
  
   Application.EnableEvents = True 
End Sub
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Try
VBA Code:
Option Explicit
Dim currentMarket As String
Private Sub Worksheet_Change(ByVal Target As Range)
If Cells(1, 21) <> "C" Then Exit Sub
Worksheets("Sheet4").Calculate
 If Target.Columns.Count = 16 Then
    Application.EnableEvents = False
 
    Range("Q2") = Range("W2")
           Range("T1") = Range("T2")
       Range("AA1") = Range("Z1")
                      If Range("S1") = 1 Then
          Call Balance
                           ElseIf Range("X2").Value = "Yes" Then
               Call Results
            Call R1
                                   
        End If
   End If
  
   Application.EnableEvents = True
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,214,976
Messages
6,122,541
Members
449,089
Latest member
davidcom

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