VBA code to get the Final Status

ranji

New Member
Joined
Jul 26, 2014
Messages
3
UVWXYZAAABACABAEAF
ReceivedSubmitalstatusReceived SubmitalstatusReceivedSubmitalStatusSampleCurrent StatusReview Period
21-10-1422-10-14C23-10-1424-10-14C25-10-1426-10-14ANo??

<tbody>
</tbody>


Dear Friends,
I am new here, Please help me obtain the VBA code as per Above Mention Table.

How to get the Current Status Automatically on (AE) column whenever or Whatever Status Code I Enter on Status Column ( (W), (Z),(AC)).
also how the get the Number of days Between tow dates in (AF) Columns.


Thanks in Advance
Ranji
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Thanks For Reply.
Actually all 3 Status Column will not be Used at same time. Suppose I have enter the Status in Column (W) then on Column (AE) Should show the Same Status, once I enter the Status on Column (Z) it should Ignore the Previous Status on (AE) and Show the Current status of Column (Z) and same for Next Column.

Thanks in Advance
 
Upvote 0
Try this
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("C3")) Is Nothing Then
        Range("K3").Value = Range("C3").Value
        Exit Sub
    End If
    If Not Intersect(Target, Range("F3")) Is Nothing Then
        Range("K3").Value = Range("F3").Value
        Exit Sub
    End If
    If Not Intersect(Target, Range("I3")) Is Nothing Then
        Range("K3").Value = Range("I3").Value
        Exit Sub
    End If
End Sub
 
Upvote 0
Now Try this for both requests
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("C3")) Is Nothing Then
        Range("K3").Value = Range("C3").Value
        Z = DateDiff("d", Range("C3").Offset(0, -2).Value, Range("C3").Offset(0, -1).Value)
        Range("L3").Value = Z
        Exit Sub
    End If
    If Not Intersect(Target, Range("F3")) Is Nothing Then
        Range("K3").Value = Range("F3").Value
        Z = DateDiff("d", Range("F3").Offset(0, -2).Value, Range("F3").Offset(0, -1).Value)
        Range("L3").Value = Z
        Exit Sub
    End If
    If Not Intersect(Target, Range("I3")) Is Nothing Then
        Range("K3").Value = Range("I3").Value
        Z = DateDiff("d", Range("I3").Offset(0, -2).Value, Range("I3").Offset(0, -1).Value)
        Range("L3").Value = Z
        Exit Sub
    End If
End Sub
 
Upvote 0
I have Try the Previous Code, I just Realize that I don't need VBA code , I need Formula for Column (AE) so I can Copy that Formula in Subsequent Lines.

I am Sorry for that.
 
Upvote 0
Try in AE2:

=IF(AC2="",IF(Z2="",IF(W2="","",W2),Z2),AC2)

To get the number of days between two dates just subtract one from the other.
 
Upvote 0

Forum statistics

Threads
1,216,167
Messages
6,129,262
Members
449,497
Latest member
The Wamp

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