View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
orquidea orquidea is offline
external usenet poster
 
Posts: 132
Default 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.