0% found this document useful (0 votes)
5 views

code

Uploaded by

diegombr87
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

code

Uploaded by

diegombr87
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Sub Aee()

x = 6
Dim matriz As String
Dim area As String
'Dim ordem As String

area = Cells(5, 2).Value


ordem = Cells(6, 2).Value
servico = Cells(5, 4).Value

Range("A2:AA10000").Select
Selection.UnMerge

Cells(3, 8).Value = "Matriz ?"


Cells(3, 13).Value = "Matriz"
Cells(3, 2).Value = "Ordem"
Cells(3, 3).Value = "Serviço"

Do Until (Cells(x, 4).Value = "" And Cells(x + 1, 4).Value = "")

If Cells(x, 2).Value = "" Then


Cells(x, 1).Value = area
Cells(x, 2).Value = ordem
Cells(x, 3).Value = servico
Else
If IsNumeric(Cells(x, 2)) Then
ordem = Cells(x, 2).Value
Cells(x, 1).Value = area
Else
area = Cells(x, 2).Value
End If
End If

If IsNumeric(Cells(x, 4)) Then


Cells(x, 13).Value = matriz
'Cells(x, 7).Select
'Selection.UnMerge
x = x + 1
Else
'Desmescla e copia para G
'Cells(x, 4).Select
'Selection.UnMerge
Cells(x, 4).Select
servico = Cells(x, 4).Value
Selection.Cut
Cells(x, 7).Select
ActiveSheet.Paste
Application.CutCopyMode = False
'Ver se tem Matriz
If Cells(x, 8).Value Like "*Matriz*" Then
matriz = Cells(x, 8).Value
'Cells(x, 8).Select
'Selection.UnMerge
Cells(x, 8).Select
Selection.Copy
Cells(x, 13).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Else
'Cells(x, 7).Select
'Selection.UnMerge
matriz = ""
End If

x = x + 1
End If

Loop
y = 5
Do Until Cells(y, 2).Value = ""
If Cells(y, 1).Value = "" Then
linha = CStr(y)
conc = linha + ":" + linha
Rows(conc).Select
Selection.Delete Shift:=xlUp
End If
y = y + 1
Loop

Rows("3:3").Select
Selection.AutoFilter
Columns("G:G").ColumnWidth = 39.86
Columns("B:B").ColumnWidth = 10.14
Columns("C:C").ColumnWidth = 30.14
Columns("M:M").ColumnWidth = 36.43
Columns("H:H").ColumnWidth = 33.43

Rows("4:900").Select
Selection.RowHeight = 15.75

End Sub

You might also like