Below code is working well there is no issue I want some modification in it,
In Col C against cust id if any alphabet D exist in col M that number in col E will be exported in file with below code with below condition
1>> if col L has 500 then code will be 20617 if col L has 1500 then code will be 15156 as per table col N and O in exported file.
2>> in col L there is 6000 in L3 but there is no 6000 in table of N and O then code will repeat that numbers two times with codes 20670,20667 (4000+2000) or 20669,20667,15142 (3000+2000+1000) also for rest if isn’t exist,
In real table isn’t exist in sheet or in file these codes will be in macro
All others thing will remain same
Thnx in advance
In Col C against cust id if any alphabet D exist in col M that number in col E will be exported in file with below code with below condition
1>> if col L has 500 then code will be 20617 if col L has 1500 then code will be 15156 as per table col N and O in exported file.
2>> in col L there is 6000 in L3 but there is no 6000 in table of N and O then code will repeat that numbers two times with codes 20670,20667 (4000+2000) or 20669,20667,15142 (3000+2000+1000) also for rest if isn’t exist,
In real table isn’t exist in sheet or in file these codes will be in macro
All others thing will remain same
Export file Modification in Code
Below code is working well there is no issue I want some modification in it, In Col C against cust id if any alphabet D exist in col M that number in col E will be exported in file with below code with below condition 1>> if col L has 500 then code will be 20617 if col L has 1500 then code...
www.excelforum.com
Thnx in advance
VBA Code:
Sub ExportData()
Dim wshS As Worksheet
Dim s As Long
Dim m As Long
Dim wbkT As Workbook
Dim wshT As Worksheet
Dim t As Long
Dim id As Variant
Application.ScreenUpdating = False
Set wshS = ThisWorkbook.Worksheets("sheet3")
m = wshS.Range("A" & wshS.rows.Count).End(xlUp).Row
Set wbkT = Workbooks.Add(xlWBATWorksheet)
Set wshT = wbkT.Worksheets(1)
wshT.Name = "SECH"
wshT.Range("A1:D1").Value = Array("SUBNO", "EQUIPID", "ACTION", "STATUS")
t = 1
For s = 2 To m
If IsNumeric(Application.Match(wshS.Range("c" & s).Value, Array(1160568), 0)) Then
For Each id In Array(15326, 37217, 37467, 15436)
t = t + 1
wshT.Range("A" & t & ":D" & t).Value = _
Array(wshS.Range("e" & s).Value, id, "INST", "N")
Next id
ElseIf IsNumeric(Application.Match(wshS.Range("g" & s).Value, Array(31979), 0)) Then
For Each id In Array(36467)
t = t + 1
wshT.Range("A" & t & ":D" & t).Value = _
Array(wshS.Range("e" & s).Value, id, "INST", "N")
Next id
ElseIf IsNumeric(Application.Match(wshS.Range("c" & s).Value, Array(8894941), 0)) Then
' These are not export
Else
For Each id In Array(15436, 15326)
t = t + 1
wshT.Range("A" & t & ":D" & t).Value = _
Array(wshS.Range("e" & s).Value, id, "INST", "N")
Next id
End If
Next s
wshT.Range("A1:D1").EntireColumn.AutoFit
wbkT.CheckCompatibility = False
wbkT.RemovePersonalInformation = True
wbkT.SaveAs "C:\Users\adeel\Desktop\AA\SECH.xls", FileFormat:=xlExcel8
wbkT.Close
Application.ScreenUpdating = True
End Sub