I'm still having problems
and this should be really simple!
Sub pruebas2_funciona()
'
' Macro4 Macro
' Macro recorded 11-01-2011 by amoya
Dim direccion1 As Integer
Dim direccion2 As Integer
Dim dir As Integer
Dim hoja As Worksheet
Dim libro As Workbook
Dim contador As Integer
Dim i As Integer
Dim dirn As Integer
Dim rn As Range
Set libro = ActiveWorkbook
contador = ActiveWorkbook.Worksheets.Count
For Each hoja In libro.Worksheets
If hoja.Name <> "EA" Or hoja.Name <> "NG" Or hoja.Name <> "Listas" Then
Cells.Find(What:="Nave", After:=hoja.Range("A1"), LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
True, SearchFormat:=False).Activate
direccion1 = ActiveCell.Row
Cells.Find(What:="Total Consumo", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
direccion2 = ActiveCell.Row
dir = direccion2 - direccion1
dirn = dir + 9
Range("B" & direccion1, "M" & direccion2).Select
Selection.Copy
Sheets("EA").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Rows(8 & ":" & dirn).Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlDown
End If
Next hoja
End Sub
It seems that the macro doesn't run over all the sheets, how can I fix this?
Bookmarks