Hello Guys,
I return a code where macro will select available column and paste it in Sheet2 (from Column B2 as transpose ) and compare the data which is available in Column A by highlighting the unmatched columns.
This code works for single file. But I have more than 15 files in a folder.
All i need is, macro should open each files which is present inside specific folder and Enter the File name in C1 and paste the columns headers from C2 (Transpose way)..,
Below code will paste file 1 Headers in Column B from..,
similarly for File 2 - File Name should be pasted in C1 and Column headers should be pasted from C2 (Paste Special - Transpose)..,
followed by File 3 - File Name should be pasted in D1 and Column headers should be pasted from D2 (Paste Special - Transpose)..,
and goes on till last file..,
I return a code where macro will select available column and paste it in Sheet2 (from Column B2 as transpose ) and compare the data which is available in Column A by highlighting the unmatched columns.
This code works for single file. But I have more than 15 files in a folder.
All i need is, macro should open each files which is present inside specific folder and Enter the File name in C1 and paste the columns headers from C2 (Transpose way)..,
Below code will paste file 1 Headers in Column B from..,
similarly for File 2 - File Name should be pasted in C1 and Column headers should be pasted from C2 (Paste Special - Transpose)..,
followed by File 3 - File Name should be pasted in D1 and Column headers should be pasted from D2 (Paste Special - Transpose)..,
and goes on till last file..,
VBA Code:
Workbooks("Formatting.xlsx").Activate
Sheets("Sheet2").Select
Range("B2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
Dim n As Integer
Dim valE As Double
Dim valI As Double
Dim i As Integer
n = 100
Application.ScreenUpdating = False
For i = 2 To n
valA = Worksheets("Sheet2").Range("A" & i).Value
valB = Worksheets("Sheet2").Range("B" & i).Value
If valA = valB Then
Else
Worksheets("Sheet2").Range("B" & i).Interior.Color = RGB(255, 0, 0)
End If
Next i