This might be easy for many of you, but i am new on VBA; Following is my code to add multiple Excel file values in to one mastersheet. While i do this , i would like to update the values regarding their key value.
Sub tekSheetMerging()
Dim masterSheet As Worksheet
Set masterSheet = sheets("KoMKo")
'Variable to save the used Range of the master sheet
Dim usedRangeMaster As Integer
Dim ws As Worksheet
'loop through each worksheet in current workbook
For Each ws In Worksheets
'If sheetname contains "data" (UCase casts the Name to upper case letters)
If InStr(1, UCase(ws.Name), "DATA", vbTextCompare) > 0 Then
'calculate the used range of the master sheet
usedRangeMaster = masterSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row + 1
'Variable to save the used Range of the sub sheet
Dim usedRangeSub As Integer
'calculate the used range of the sub sheet
usedRangeSub = ws.UsedRange.SpecialCells(xlCellTypeLastCell).Row
'copy relevant range from the subsheet
ws.Range("C1:C" & usedRangeSub).Copy
'paste the copied range after the used range in column a
masterSheet.Range("A" & usedRangeMaster).PasteSpecial
End If
Next ws
End Sub
So, now I have an Excel table which includes a key value in Column A and other values in other Columns in that row. When i find a key which is duplicate of the key value which is added before, I would like to delete that cell and its complete row. By doing so i would like to update the values, regarding their key value. If i would add another key, it should stay in the list with no Problem though.
How can i do this?