Need help using If Statement with different criteria Create/Update/Delete

Gingging

New Member
Joined
Apr 14, 2015
Messages
2
Hello,

Good day!

May I ask for your help? I'm having trouble in creating If statement with different criteria. The criteria are create, update and delete.

Created: Newly added data will be tagged as "Created + date it was created" on the "status" column
Updated: Existing data but you update something then it will be tagged as "Updated + date it was updated" on the "status" column
Deleted: If Column Test 4 was tagged as "No" then "status" column will be tagged as "Deleted + date it was deleted"
*Old - if no changes

The criteria will only be applied if changes made are not under the column with field name "Check".

Below is a sample scenario.
Status
Test 1
Test 2
Test 3
Test 4
Check - XXXX
Old
Data 1
Data 8
Data 15
Yes
1
Deleted
Data 2
Data 9
Data 16
No
2
Created
Data 3
Data 10
Data 17
Yes
3
Updated
Data 4
Data 11
Data 18
Yes
4
Old
Data 5
Data 12
Data 19
No
1
Old
Data 6
Data 13
Data 20
No
2
Old
Data 7
Data 14
Data 21
Yes
6

<tbody>
</tbody>

Below is my current code but only with update criteria. Hope you can help me. Thank you in advance.
Option Explicit
__________________________________________

Sub Test(ByVal sel As Range)
Dim cell As Range
Dim LastColumn As Long

LastColumn = Cells(1, Cells.Columns.Count).End(xlToLeft).Column
For Each cell In sel
Application.EnableEvents = False
If cell.Row > 8 And cell.Column > 1 And cell.Column < LastColumn + 1 Then
If Left(Cells(1, cell.Column), 5) = "Check" Then
GoTo A
Else
Cells(cell.Row, "A").Value = "Updated at " & Date
End If
End If
A:
Application.EnableEvents = True

Next cell
End Sub


I'm using MSExcel 2010.
 
Last edited:

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,215,479
Messages
6,125,041
Members
449,206
Latest member
Healthydogs

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