RAJESH1960
Banned for repeated rules violations
- Joined
- Mar 26, 2020
- Messages
- 2,313
- Office Version
- 2019
- Platform
- Windows
Hello guys
Once again I need your help to correct the code. When I tested this code in a different data, I faced a problem. At first, when I tested when one or more ledgers were not available in the data base that is LIst of ledgers in data base and ledgers in Paste data, it worked correctly. When I pasted a new data in Paste data sheet, the master data sheet it showed blank since all ledgers were available and hence it will exit the sub. But the problem is it copies the headings from cell C1:F1 to C2:F2 which in turn will effect the import Master sheet.
In the below line of code, it is already mentioned that if B2 = "", exit sub.
and this line is where it is copying the headings
1. Query stop code from copying headings.xlsm
To understand the problem, Please, check once by deleting the names January to December from List of ledgers sheet. Then, enter the names from January to December in the List of ledgers sheet again and please re-check.
Once again I need your help to correct the code. When I tested this code in a different data, I faced a problem. At first, when I tested when one or more ledgers were not available in the data base that is LIst of ledgers in data base and ledgers in Paste data, it worked correctly. When I pasted a new data in Paste data sheet, the master data sheet it showed blank since all ledgers were available and hence it will exit the sub. But the problem is it copies the headings from cell C1:F1 to C2:F2 which in turn will effect the import Master sheet.
In the below line of code, it is already mentioned that if B2 = "", exit sub.
Rich (BB code):
Call Pre_XML_Code ' Perform preliminary actions
'
If Sheets("MasterData").Range("B2") = vbNullString Then ' If B2 in MasterData is blank then ...
MsgBox "All Ledgers Available. Press Generate Purchase.XML" ' Display message to user
Exit Sub
Rich (BB code):
If LedgerCount > 1 Then .Range("C2:E" & .Cells(Rows.Count, 2).End(xlUp).Row).FillDown ' Copy the C2:E2 formulas down to last row of B
End With
To understand the problem, Please, check once by deleting the names January to December from List of ledgers sheet. Then, enter the names from January to December in the List of ledgers sheet again and please re-check.