View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Sethaholic[_2_] Sethaholic[_2_] is offline
external usenet poster
 
Posts: 1
Default How to perform action in all worksheets


I did as you told, and when I run the macro, it pauses for a while, and
it seems to work. But then I check the numbers and they are not right.
It seems as if nothing happened even. Do you think I'm missing
something? Here's my new code:

Sub ExtractData()

Dim intRec As Integer, rngData As Range, rngItem As Range, rngComb
As Range, rngOut As Range
Dim mysht As Worksheet

Application.ScreenUpdating = False

For Each mysht In ThisWorkbook.Worksheets
With mysht
Set rngData = Range("C33:C" &
Range("C60").End(xlUp).Row).SpecialCells(xlCellTyp eConstants)
End With

With Workbooks("text").Worksheets("sheet1")
Set rngComb = Range("A1:A" & .Range("A65536").End(xlUp).Row)

End With

For Each rngItem In rngComb
If rngItem = "stop" Then Exit Sub
Set rngOut = rngData.Find(What:=rngItem)

If Not rngOut Is Nothing Then
rngOut.Offset(0, 2).Value = rngItem.Offset(0, 4).Value
rngOut.Offset(0, 3).Value = rngItem.Offset(0, 5).Value
rngOut.Offset(0, 4).Value = rngItem.Offset(0, 6).Value
rngOut.Offset(0, 5).Value = rngItem.Offset(0, 7).Value
Else
End If
Next rngItem
Next mysht
Application.ScreenUpdating = True

End Sub



thanks in advance!


--
Sethaholic
------------------------------------------------------------------------
Sethaholic's Profile: http://www.excelforum.com/member.php...o&userid=25113
View this thread: http://www.excelforum.com/showthread...hreadid=386165