If you don’t have the list yet:
Elena stared at the spreadsheet on her screen. It was 11:47 PM. The Plan de Cuentas Contables de Venezuela—the official chart of accounts mandated by the SUNDDE and the FISCAL-i system—spread across 47 sheets like a drunk centipede. plan de cuentas contables venezuela excel vba
Every month, she had to:
Her assistant, José, quit last week. His farewell message: "Elena, I’d rather sell tequeños from a cart than touch another VLOOKUP." If you don’t have the list yet: Elena
She laughed bitterly. Then she opened the Visual Basic for Applications (VBA) editor. Her assistant, José, quit last week
Sub GenerarListaJerarquica() Dim wsPlan As Worksheet Dim wsOutput As Worksheet Dim lastRow As Long Dim i As Long Dim nivel As Integer Dim indent As StringSet wsPlan = ThisWorkbook.Sheets("Plan_Cuentas") Set wsOutput = ThisWorkbook.Sheets.Add wsOutput.Name = "VistaJerarquica" lastRow = wsPlan.Cells(wsPlan.Rows.Count, 1).End(xlUp).Row For i = 2 To lastRow nivel = wsPlan.Cells(i, 3).Value ' columna Nivel indent = String(nivel - 1, "-") wsOutput.Cells(i - 1, 1).Value = indent & wsPlan.Cells(i, 1).Value wsOutput.Cells(i - 1, 2).Value = wsPlan.Cells(i, 2).Value Next i
End Sub