Henriquebss
08-12-2018 01:13:57
Por que a linha em amarelo não funciona?
col = 3
Do Until Sheets("Tabela").Cells(1, col) = ComboBox1
col = col + 2
Loop
Sheets("Tabela").Cells(((col + 1) / 2), 1) = ""
Worksheets("Tabela").Range(Cells(1, col), Cells(Rows.Count, col + 1).End(xlUp)) = ""
If Sheets("Tabela").Cells(1, col) = "" And Sheets("Tabela").Cells(1, col + 2) <> "" Then
Sheets("Tabela").Range(Cells(1, col).End(xlToRight), Cells(100, (Me.ComboBox1.ListCount * 2) + 2)).Cut
ActiveSheet.Paste Destination:=Sheets("Tabela").Cells(1, col)
Sheets("Tabela").Range(Cells(((col + 1) / 2), 1).End(xlDown), Cells(Rows.Count, 1).End(xlUp)).Select
Selection.Cut
Cells(((col + 1) / 2), 1).End(xlUp).Offset(1, 0).Select
ActiveSheet.Paste
Application.CutCopyMode = False
End If
Worksheets("Menu Inicial").Activate
ComboBox1.Clear
ListBox1.Clear
Call UserForm_Activate
col = 3
Do Until Sheets("Tabela").Cells(1, col) = ComboBox1
col = col + 2
Loop
Sheets("Tabela").Cells(((col + 1) / 2), 1) = ""
Worksheets("Tabela").Range(Cells(1, col), Cells(Rows.Count, col + 1).End(xlUp)) = ""
If Sheets("Tabela").Cells(1, col) = "" And Sheets("Tabela").Cells(1, col + 2) <> "" Then
Sheets("Tabela").Range(Cells(1, col).End(xlToRight), Cells(100, (Me.ComboBox1.ListCount * 2) + 2)).Cut
ActiveSheet.Paste Destination:=Sheets("Tabela").Cells(1, col)
Sheets("Tabela").Range(Cells(((col + 1) / 2), 1).End(xlDown), Cells(Rows.Count, 1).End(xlUp)).Select
Selection.Cut
Cells(((col + 1) / 2), 1).End(xlUp).Offset(1, 0).Select
ActiveSheet.Paste
Application.CutCopyMode = False
End If
Worksheets("Menu Inicial").Activate
ComboBox1.Clear
ListBox1.Clear
Call UserForm_Activate