Visual Basic para Aplicaciones - Utilizar una macro como Rango en otra Macro

Life is soft - evento anual de software empresarial
 
Vista:

Utilizar una macro como Rango en otra Macro

Publicado por Germán (1 intervención) el 13/05/2015 03:00:25
Hola, buena tarde.

Deseo utilizar una macro para indicar el rango en otro proceso, he aquí las dos macros:

1.-Macro que define el rango
1
2
3
4
5
6
7
8
Sub CatGPSOne()
    Range("I1:T1").Select
    Selection.Find(What:="1", After:=ActiveCell, LookIn:=xlFormulas, _
        LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False).Activate
        ActiveCell.Offset(1, 0).Select
        Selection.Resize(Selection.Rows.Count + 50, Selection.Columns.Count + 0).Select
End Sub

2.-Macro que ordena de forma ascendente los valores del rango anteriormente seleccionados.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Sub CatOrder()
    ActiveSheet.Unprotect "2412ZagXiFa2412"
    Range("I2:I52").Select
    Selection.AutoFilter
    ActiveWorkbook.Worksheets("Catálogos").AutoFilter.Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Catálogos").AutoFilter.Sort.SortFields.Add Key:= _
        Range("I2:I52"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
        xlSortNormal
    With ActiveWorkbook.Worksheets("Catálogos").AutoFilter.Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    Selection.AutoFilter
    Range("I3").Select
    ActiveSheet.Protect "2412ZagXiFa2412"
End Sub

Agradezco de antemano el apoyo, saludos.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder