Hello Friends,
I was able before to Copy Column base on Condition from "absent11d7.xlsx" file to display the result in "NewAbsentData.xlsx" using the Code below.
Currently i want to move One Step Above: The final file "NewAbsentData.xlsx" have two columns "Last name" & "First name" So
As Optional Step using Checkbox would like to Compare "Email address" column in "NewAbsentData.xlsx" file with "cid" in "students.xlsx" file
To Display "Full name" column instead of "Last name" & "First name" in "NewAbsentData.xlsx" file. How i can do that ?
Note: "Email address" column contain cid so if email is: S304101600358@moe.edu.kw than the cid will be 304101600358.
Files to test:
I was able before to Copy Column base on Condition from "absent11d7.xlsx" file to display the result in "NewAbsentData.xlsx" using the Code below.
Currently i want to move One Step Above: The final file "NewAbsentData.xlsx" have two columns "Last name" & "First name" So
As Optional Step using Checkbox would like to Compare "Email address" column in "NewAbsentData.xlsx" file with "cid" in "students.xlsx" file
To Display "Full name" column instead of "Last name" & "First name" in "NewAbsentData.xlsx" file. How i can do that ?
Note: "Email address" column contain cid so if email is: S304101600358@moe.edu.kw than the cid will be 304101600358.
Files to test:
absent11d7.xlsx and 1 more file
2 files sent via WeTransfer, the simplest way to send your files around the world
we.tl
VBA Code:
Sub CopyCols()
Application.ScreenUpdating = False
Dim wsCopy As Worksheet, WB As Workbook, x As Long, LastRow As Long, lCol As Long
Set WB = ThisWorkbook
Workbooks.Open "C:\Users\Working\Desktop\absent11d7.xlsx"
Set wsCopy = Sheets(1)
wsCopy.Cells.Replace What:="", Replacement:="|", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
wsCopy.Cells.Replace What:="|", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Workbooks.Add 1
With wsCopy
LastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
lCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
For x = 1 To lCol
If WorksheetFunction.CountA(.Columns(x)) >= LastRow - 11 Then
.Columns(x).Copy Cells(1, Columns.Count).End(xlToLeft).Offset(0, 1)
End If
Next x
End With
Columns(1).Delete
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=WB.Path & "\NewAbsentData.xlsx"
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub