F1.20

(macros) Encontrar un valor en una selección en Word

F2.00

(macros) Subprocedimiento protegerceldas

F2.10

(macros) Función patron

F2.25

(macros) Sub euros a dolares y libras

F2.26

(macro) en Word para poner/quitar formato párrafo

Páginas:
(macros) Subprocedimiento protegerceldas

variables públicas
Public RA, RB, uxx, dosceldas As String
Public IXX, ban, borrador As Integer
Public mirango As Range

______________________

Sub protegerceldas()
 Dim unaref, unerangos, unesec As Range
 Static dosceldas As String
 Dim lahoja, lahojasec As String
 Dim i, lafil As Integer
 Dim encontrada As Boolean
 lahoja = ActiveSheet.Name
 Set mirango = Range(ActiveCell, ActiveCell.Cells(Selection.Rows.Count, 
 Selection.Columns.Count))
 dosceldas = mirango.Address(RowAbsolute:=False, ColumnAbsolute:=False)
 For i = 1 To Sheets.Count
   If Sheets(i).Name = "sec" & ActiveSheet.Name Then
      ban = 1
   End If
 Next i
 If ban <> 1 Then
   Set NewSheet = Sheets.Add(Type:=xlWorksheet, After:=Worksheets(Worksheets.Count))
   NewSheet.Name = "sec" & lahoja
   Range(dosceldas).Name = ActiveSheet.Name
   Sheets.Item(lahoja).Activate
   Range(dosceldas).Select
   Range(dosceldas).Name = ActiveSheet.Name
 Else
   Set unerangos = Union(Range(ActiveSheet.Name), mirango)
   unerangos.Name = ActiveSheet.Name
   Sheets.Item("sec" & ActiveSheet.Name).Activate
   Sheets.Item(ActiveSheet.Name).Range(dosceldas).Select
   Set unesec = Union(Range(ActiveSheet.Name), Range(dosceldas))
   unesec.Name = ActiveSheet.Name
   Sheets.Item(lahoja).Activate
 End If
 For Each ciclo In Sheets.Item("sec" & ActiveSheet.Name).Range(dosceldas).Cells
  If ciclo.Value <> 1 Or ciclo.Value <> 2 Then
     borrador = 0
  Else
     borrador = 1
  End If
 Next
 If borrador = 0 Then
   mirango.Interior.Color = RGB(250, 250, 250)
   mirango.Borders.Color = RGB(105, 105, 105)
   For Each ciclo In Sheets.Item("sec" & ActiveSheet.Name).Range("sec" & 
         ActiveSheet.Name).Cells
      ciclo.Value = "=patron(" & lahoja & "!" & ciclo.Address(RowAbsolute:=True, 
      ColumnAbsolute:=True) & ")"
   Next
 Else
   mirango.Interior.Color = RGB(255, 252, 255)
   mirango.Borders.Color = RGB(208, 215, 229)
   For Each ciclo In Sheets.Item(lahoja).Range(dosceldas).Cells
       ciclo.Value = " "
   Next
   For Each ciclo In Sheets.Item("sec" & ActiveSheet.Name).Range(dosceldas).Cells
       ciclo.Value = ""
   Next
 End If
End Sub

________________

(macros) Subprocedimiento protegerceldas







Sesión:
registrar en twiiter
Inicie sesión ...


Editores de contenidos

No es un Editor...



Títulos


Tweets aulapc.es:





 eduardo@aulapc.es Granada (España)