So here is what I need to have happen. Excuse me the code and excel file I have attached are seperate to prevent user data on the web I created the test file based from the Quickbooks data file I use for multiple excel macros.
I am trying to automate the process of creating a dynamic list based upon the test file attached. I want it to find every instance of the word "Bill Pmt -Check" in column B and copy the business name once it finds the word "Bill Pmt-Check" that is in column H of the same row. I would like it to continue until it cannot find another Bill Pmt-Check.
Here is what I have tried so far and I think it might be bad programming: ie I have it first searching for the number of instances of the word Bill Pmt -Check and recording that value in a cell. Then it stops copying business names once it hits that value of the cell aka the number of businesses it copies stops when it reaches the total NUMBER of businesses.'
This script is not working as it records the value 0 still:
Sub Macro1x()
'
' Macro1x Macro
'
'
Dim inty As Integer
inty = 2
Worksheets("Sheet2").Activate
Dim numofbus As Integer
numofbus = 0
'SHOULD RECORD HOW MANY INSTANCES OF EACH BUSINESS TO KNOW WHEN TO STOP COPYING BELOW
Do While Cells.Find(What:="Bill Pmt -Check", After:=Sheet2.Cells(1, 1), LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=True, SearchFormat:=False) = True
numofbus = numofbus + 1
Loop
Application.Wait (Now + TimeValue("0:00:01"))
Cells(44, 1).Value = numofbus
Cells.Find(What:="Bill Pmt -Check", After:=Sheet2.Cells(1, 1), LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, 6).Activate
ActiveCell.Copy
Sheets("Sheet1").Cells(1, 23).PasteSpecial xlPasteAll
Set FoundCell = Worksheets("Sheet2").Cells.Find(What:="Bill Pmt -Check", After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
'SHOULD COPY THE BUSINESS NAMES AND STOP WHEN IT RECEIVES HITS THE ROW NUMBER THAT IS THE SAME AS THE INTEGER SAVED AKA NUMBER OF BUSINESSES
Do Until ActiveCell.Row = Cells(44, 1).Value
Worksheets("Sheet2").Activate
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Offset(0, 6).Activate
ActiveCell.Copy
Worksheets("Sheet1").Activate
Sheets("Sheet1").Cells(inty, 23).Activate
ActiveCell.PasteSpecial (xlPasteAll)
inty = inty + 1
Loop
End Sub
Bookmarks