Hola KL
Esta algo largo el codigo, espero que sea entendible...
tambien me gustaria saber que puedo poner en el codigo
para que se detenga, porque al terminar la ultima opcion,
vuelve a comenzar.
Sub Union()
'
' Macro1 Macro
' Macro grabada el 01/04/2005 por ocruz
Dim Asig As String
Dim Canc As String
Dim Res As String
Dim Reg As String
Dim Esp As String
Dim Atn As String
Dim R As Range
Asig = "Asignado"
Canc = "Cancelado"
Res = "Resuelto"
Reg = "Registro"
Esp = "En espera"
Atn = "En atencion"
Range("B50").Select
ActiveSheet.Next.Select
With ActiveSheet.PivotTables("Tabla
dinámica3").PivotFields("SUBESTATUS")
.Orientation = xlRowField
.Position = 2
End With
Dim Rangostar As Range
Range("A4:A100").Select
For Each R In Selection
Selection.Find(What:=Canc, After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False).Activate
ActiveCell.Select
ActiveCell.Next.Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
ActiveSheet.Previous.Select
Range("B50").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
ActiveSheet.Next.Select
Range("A4:A100").Select
Selection.Find(What:=Reg, After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False).Activate
ActiveCell.Select
ActiveCell.Next.Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
ActiveSheet.Previous.Select
Range("B81").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
ActiveSheet.Next.Select
Range("A4:A100").Select
'Else
Selection.Find(What:=Res, After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False).Activate
ActiveCell.Select
ActiveCell.Next.Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
ActiveSheet.Previous.Select
Range("B82").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("B62").Select
ActiveSheet.Next.Select
Range("A4:A100").Select
'Else
Selection.Find(What:=Asig, After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False).Activate
ActiveCell.Select
ActiveCell.Next.Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
ActiveSheet.Previous.Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("B62").Select
ActiveSheet.Next.Select
Range("A4:A100").Select
'Else
Selection.Find(What:=Esp, After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False).Activate
ActiveCell.Select
ActiveCell.Next.Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
ActiveSheet.Previous.Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("B62").Select
ActiveSheet.Next.Select
Range("A4:A100").Select
'Else
Selection.Find(What:=Atn, After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False).Activate
ActiveCell.Select
ActiveCell.Next.Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
ActiveSheet.Previous.Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("B62").Select
ActiveSheet.Next.Select
Range("A1").Select
End
End Sub
Leer las respuestas