Te mando las nuevas macros
Sub Macro2()
'Agrupa por fechas
'Por.dam
Worksheets("base").Select
Range("A1").Select
ufil_base = ActiveCell.SpecialCells(xlLastCell).Row
ucol_base = ActiveCell.SpecialCells(xlLastCell).Column
Columns("A:E").Select
Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(3, 4, 5), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
ActiveSheet.Outline.ShowLevels RowLevels:=2
Range("B1:E1").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Worksheets("consolidado").Select
Range("C12").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
Selection.Replace What:="Total ", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Worksheets("base").Select
Columns("B:E").Select
Selection.RemoveSubtotal
Worksheets("consolidado").Select
ufil_consol = ActiveCell.SpecialCells(xlLastCell).Row
ucol_consol = ActiveCell.SpecialCells(xlLastCell).Column
'Crea hiperlink
'copia la base en consolidado
Worksheets("base").Select
Columns("A:F").Select
Selection.Copy
Sheets("consolidado").Select
Range("FA1").Select
ActiveSheet.Paste
For i = 4 To ucol_consol
Cells(12, i).Select
If IsDate(Cells(12, i)) Then
fecha = Cells(12, i)
'Worksheets("base").Select
Columns("FB:FB").Select
Set RangoObj = Selection.Find(What:=fecha, _
After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
Cells(12, i).Select
'Worksheets("consolidado").Select
linea_buscar = RangoObj.Row
'ActiveSheet.Hyperlinks.Add Anchor:=Selection, _
Address:="", SubAddress:="base!B" & linea_buscar
ActiveSheet.Hyperlinks.Add Anchor:=Selection, _
Address:="", SubAddress:="consolidado!FB" & linea_buscar
Else
If Cells(12, i) = "general" Then
Range(Cells(12, i), Cells(12 + 3, i)).Clear
i = ucol_consol
End If
End If
Next
Cells(12, 3).Select
MsgBox ("Agrupado con éxito")
End Sub
'***Macro***
Para la siguiente macro
Instrucciones
1. Abre tu hoja de excel
2. Para abrir Vba-macros y poder pegar la macro, Presiona ALt + F11
3. Del lado izquierdo dice: VBAProject, abajo dale doble click a worksheet(consolidado)
4. Del lado derecho copia la macro
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
'por.dam
fecha = ActiveCell
Columns("FA:FF").Select
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:=fecha, Operator:=xlAnd
Application.Goto ActiveWorkbook.Sheets("desglosado").Range("A14:F1000")
Selection.Clear
Application.Goto ActiveWorkbook.Sheets("consolidado").Range("FA1:FF1")
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Application.Goto ActiveWorkbook.Sheets("desglosado").Cells(13, 1)
ActiveSheet.Paste
Worksheets("consolidado").Select
Selection.AutoFilter
Application.Goto ActiveWorkbook.Sheets("consolidado").Cells(12, 3)
Application.Goto ActiveWorkbook.Sheets("desglosado").Cells(1, 1)
End Sub
saludos.dam
Por favor, cierra las preguntas que tienes abiertas.