Hi,
I have 2 workbooks. In the first workbook, I have a number of sheets each with their own account numbers. IN The second workbook ("text, shee1"), I have a listing of the account numbers along with revenues, expenses, and available balance next to each account. I am trying to match the account numbers in workbook1 with those in workbook2, and if they match, then to copy the info I need into workbook1. When I run the macro, it seems to be running ok with no errors. But then I notice that nothing has changed. Am i missing something here? Thanks in advance
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", .Range("C60").End(xlUp)).SpecialCells(xlCellTypeConstants)
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
Bookmarks