473,777 Members | 1,732 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

1 New Member
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 1387
Guido Geurs
767 Recognized Expert Contributor
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
9487
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
3531
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 OrderItem with the highest interval and discard all other duplicates for that OrderItem number. If the OrderItem and the Interval are exactly the same, it just needs to keep one entry for the OrderItem.
4
8365
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 Outlook Inbox every hour for the existence of a mail from a certain address. If it finds one, it saves the attachment and then imports the contents of the attachment. However, before the import takes place, the text file is checked to make sure...
0
1120
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 shows the number of records in 'Providers' and the number of records in 'Services' for each of the different numerical regions. Something like this: ================================================ Region Providers ...
5
10865
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 counts ALL records whether Record Type = "S" or "M" There is nothing unique about the records to distinguish S-type records from the M-type records.
1
1370
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 event that there is a Purchase Cost entered which is > then 0 but the Standard = 0, I would like a popup to display which halts the process until a Standard gets entered. I am not a coder but I can usually cobble the code together through some...
2
9017
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 patients in a table Const strDBPath = "C:\Patients.mdb" ' external database Set dbPatients = OpenDatabase(strDBPath, False, True, ";PWD=abc")
2
1156
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 and list the ones that contain the string? Thanks, Dave
1
3111
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 to find the last record of when a certain customer had their skip changed over, I need to scan through almost every record for that customer. This is probably really simple and i'm not familiar with the filters, however, what I need is a search...
0
9628
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10292
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7471
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6722
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5368
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.