ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Counter in macro (https://www.excelbanter.com/excel-discussion-misc-queries/229165-counter-macro.html)

orquidea

Counter in macro
 
I set a loop which is supposed to go over all the list in file Switch
Accounts. There is a list of 10 different companies and retrieve the data
from the same customer from file ord-dump. The macro below is not going over
the file swith account but over the ord-dump. I can't figure out the error.
Could anyone help me pls.

'open file with list
Workbooks.Open Filename:="H:\Switch Accounts.xls"

RangeCount = 2
BillAccount = Range("a" & RangeCount)

'activate file with data

Windows("ord-dump.csv").Activate

Sheets.Select

Do Until ActiveCell.Offset(2, 0) = ""

'Find cell
Cells.Find(What:=(BillAccount), After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate


Selection.CurrentRegion.Select
Selection.Copy

Sheets.Add

Range("A2").Select
ActiveSheet.Paste


RangeCount = RangeCount + 1

Loop


Thanks in advance.




All times are GMT +1. The time now is 08:32 PM.

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