ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   HELP! What's wrong with my code? (https://www.excelbanter.com/excel-programming/334198-help-whats-wrong-my-code.html)

Sethaholic[_6_]

HELP! What's wrong with my code?
 

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(xlCellTypeCo nstants)
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

--
Sethaholi
-----------------------------------------------------------------------
Sethaholic's Profile: http://www.excelforum.com/member.php...fo&userid=2511
View this thread: http://www.excelforum.com/showthread.php?threadid=38621



All times are GMT +1. The time now is 03:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com