473,441 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,441 software developers and data experts.

How to return a number that represents the row after certain criteria is met?

I'm trying to write a macro that will keep track of sales/commissions. I have written a simple macro that will ask the user for data using input boxes, and place that data into an inserted line. The sheet is divided into two areas, one above the other. To sort the first set of sales by invoice number, I wrote a macro to look for data beyond line 3 to the first blank line and sort by column A. However, I do not know how to make it sort the lower data because the data does not always start on the same row. If there are many rows in the top section, the lower section gets pushed farther down the sheet. The first cell of the sort point is one cell below the second time the word "Invoice" appears on the sheet. Can I write a macro to return a number that represents the row after the second time the word "Invoice" appears in column A?
Jan 31 '11 #1
1 1371
Guido Geurs
767 Expert 512MB
Expand|Select|Wrap|Line Numbers
  1. Sub Find_Invoice()
  2.    Range("A1").Activate
  3.    Cells.Find(What:="Invoice", After:=ActiveCell, LookIn:=xlValues, LookAt _
  4.        :=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase _
  5.        :=True, SearchFormat:=True).Activate
  6.    Cells.FindNext(After:=ActiveCell).Activate
  7.    ActiveCell.Offset(1, 0).Activate
  8.    MsgBox "Row= " & ActiveCell.Row
  9. End Sub
Jan 31 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Andy | last post by:
Could anyone tell me how to round off a number to certain significant figures using C++? For example, how to round off a number 12567 to 13000 (2 significant figures)?
1
by: Smythe32 | last post by:
If anyone could help, I would appreciate it. I have a table as listed below. I need to check for duplicates by the OrderItem field and if there are duplicates, it then needs to keep the...
4
by: Mark | last post by:
Hi All, I'm trying my hardest to learn VBA but have run into a problem which hopefully someone can guide me with. Basically what I am trying to achieve is to get the database to check the users...
0
by: Scott at Cedar Creek | last post by:
I have to SQL Tables...one called 'Providers' and one called 'Services'...they each contain, among many other things, a field called 'Region' What I would like to accomplish is a table that...
5
by: Soccer5 | last post by:
Trying to Count records on a report that meet a certain criteria. Have a text box in the Report Footer that has the following in the Control Source: =Count(="S") This does not work. It...
1
by: rpk740 | last post by:
Access 2000 Database using VBA. Windows XP SP2. English. I have a form which contains some bits of information. Item Number, Purchase Cost, Standard Cost, and a Purchase Order Number. In the...
2
by: mfaisalwarraich | last post by:
Hi Everybody, I am using the following code to get the recordset of an external database. Dim dbPatients As Database Dim rsCountPatients As Recordset ' to count number of...
2
by: DancingDave | last post by:
Hi, I need to locate all the queries in my .mdb that have a certain string in the criteria field. Is there some kind of search mechanism or 3rd party tool that can look through my queries for me...
1
by: Blaikie | last post by:
Hello, I have a basic database to record all customer orders for the Skip Hire company I work for. At the moment I use the 'Find and Replace' function to search through the database so when I need...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.