VBA Code Changes Required

HSAR

Banned - Rules violations
Joined
Jul 6, 2020
Messages
37
Office Version
  1. 2016
Platform
  1. Windows
Using below code and have tried a lot to make some changes in code but could not as have shared in picture.

I want this result from below code

Please help.
1595261662740.png





VBA Code:
Sub TextDate()

    With Sheets("data")
        f = .Cells(.Rows.Count, "F").End(xlUp).Row
        If f > 3 Then .Range("F4:H" & f).ClearContents
        
        'Coder Name Range Don't Chnage it
        .Range("G3") = .Range("C1")
        
        f = 3
        For y = 3 To 33
            a = .Cells(y, "A") 'Used for Date format
            b = .Cells(y, "C")
            c = .Cells(y, "D")
            d = .Cells(y, "E") 'Used for Comment section
            
            If b <> Empty And b <> Empty Then
                Select Case b
                    Case "a", "A"
                        txt = "Absent "
                    'Case "1", "L"
                        txt = "Late "
                    Case Else
                        txt = "Leave "
                End Select
                
                f = f + 1
                .Cells(f, "G") = Format(a, "ddd dd-mmm-yyyy") 'Used for Date format
                
                .Cells(f, "H") = txt
                .Cells(f, "I") = txt
                
                .Cells(f, "J") = d 'Used for Comment section
            End If
        Next y
    End With

End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Here is the sheet where from the data is being taken.

1595263303623.png



If code gives result according to below picture then it will be better.

1595263139578.png
 
Upvote 0
Hi team looking for a solution.
 
Upvote 0

Forum statistics

Threads
1,214,588
Messages
6,120,409
Members
448,959
Latest member
camelliaCase

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