HELP! What's wrong with my code?

S

Sethaholic

Hi,

I have 2 workbooks. In the first workbook, I have a number of sheet
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 t
match the account numbers in workbook1 with those in workbook2, and i
they match, then to copy the info I need into workbook1. When I run th
macro, it seems to be running ok with no errors. But then I notice tha
nothing has changed. Am i missing something here? Thanks in advance



Sub ExtractData()

Dim intRec As Integer, rngData As Range, rngItem As Range, rngComb A
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 Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top