Create New Sheet - Conditional

ashani

Active Member
Joined
Mar 14, 2020
Messages
345
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm using the below code so everytime there is value of 20 or -20 than system copies sheet 1 which is fine. What I want is 2 conditions before it creates another sheet so if there is a number of 1, 3 & 5 in D5:D58 and +/- 20 in E5:E58 than it should create a sheet, otherwise shouldn't

Please can somebody guide me ont his.

Thank you

VBA Code:
  If Target.CountLarge > 1 Then Exit Sub
  If Target.Value = "" Then Exit Sub
  If Not Intersect(Target, Range("E5:E58")) Is Nothing Then
    If IsNumeric(Target.Value) Then
    If Abs(Target.Value) >= 20 Then
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Try this

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.CountLarge > 1 Then Exit Sub
  If Target.Value = "" Then Exit Sub
  If Not Intersect(Target, Range("E5:E58")) Is Nothing Then
    If IsNumeric(Target.Value) Then
      If Abs(Target.Value) >= 20 Then
        Select Case Cells(Target.Row, "D").Value
          Case 1, 3, 5
            ' copies sheet 1
        End Select
      End If
    End If
  End If
End Sub
 
Upvote 0
I'm glad to help you. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,093
Latest member
dbomb1414

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