MACRO CELDAS EN UN SOLO LIBRO
-
Upload
ricardo-carlos -
Category
Documents
-
view
212 -
download
0
description
Transcript of MACRO CELDAS EN UN SOLO LIBRO
Empezamos con un libro Excel cualquier, pero que tenga por
lo menos dos hojas. Luego vamos a crear un módulo dentro de
este libro. En este módulo escribimos el código.
Sub Links_hojas()
Dim wrbLibro As Workbook
Dim wrsHojaActiva As Worksheet, wsHoja As Worksheet
Dim intFila, intColumna As Integer
Set wrbLibro = ActiveWorkbook
Set wrsHojaActiva = ActiveSheet
'en que fila/columna empezar la lista
intFila = 4
intColumna = 1
'el bucle repasa todas las hojas
For Each wsHoja In wrbLibro.Worksheets
'para excluir hoja de los links
If wsHoja.Name = "Hoja4" Then GoTo ProxHoja
'crear links
If wsHoja.Name <> wrsHojaActiva.Name Then
wrsHojaActiva.HyperLinks.Add wrsHojaActiva.Cells(intFila, intColumna), _
"", SubAddress:="'" & wsHoja.Name & "'!A1", TextToDisplay:=wsHoja.Name
intFila = intFila + 1
End If
ProxHoja:
Next wsHoja
End Sub