Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Sequencial numbering

Hi there,

Bit of an Access/Excel newbie here in need of some help. First time in here
so please be gentle with me.

Here's what I'm trying to achieve. I want to build a database which records
the changes on a project with each project having it's own unique code based
on the year so for example:

05666
04555
03444

I've build the database itself and created an Excel front end form to input
the data to the database. What I would like to achieve is for each project
number to have it's own sequencial record number for example:

05666-1
05666-2
04555-1
04555-2
04555-3
03444-1
03444-2

you get the idea. How do I do this? It's really stumped me. I guess I really
need to know what VBA to put into the Excel form to look at teh last number
allocated to a project and just add one. If this can be done automagically on
selecting the required project then all the better.

I can get Access to allocate a sequential number to each new entry but not
to each new entry for an individual project. Does the make sense?

Your thoughts and help would be greatly appreciated.

Just let me nkow if you need any more information.

Rich
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default Sequencial numbering

Hi Richard
This might point you in the right direction
The core of the solution I used recently doing a similar thing was Instr

Set tbl = Range("A1:A10")
For each c in tbl
'Get number of items in list and first and last row number
If Left(c, InStr(c, "-") - 1) = Left(orderID, InStr(orderID, "-") - 1) Then
sameidcntr = sameidcntr + 1
If sameidcntr = 1 Then firstsameid = c.Row
lastsameid = c.Row
End If

firstsameid to lastsameid is the range of the outer index you are seeking.
Then do:

Set tbl = Cells(lastsameid + rwcntr, Range("A1:A10").Column)
'Now add 1 to last inner index
newID = Left(tbl, InStr(tbl, "-") - 1) & "-" & Right(tbl, Len(tbl) -
InStr(tbl, "-")) + 1
neworderrow = lastsameid + 1 + rwcntr
rwcntr = rwcntr + 1

I was inserting a new line for each new id generated but this gives you the
general idea.

HTH

Geoff


"Richard Setford" wrote:

Hi there,

Bit of an Access/Excel newbie here in need of some help. First time in here
so please be gentle with me.

Here's what I'm trying to achieve. I want to build a database which records
the changes on a project with each project having it's own unique code based
on the year so for example:

05666
04555
03444

I've build the database itself and created an Excel front end form to input
the data to the database. What I would like to achieve is for each project
number to have it's own sequencial record number for example:

05666-1
05666-2
04555-1
04555-2
04555-3
03444-1
03444-2

you get the idea. How do I do this? It's really stumped me. I guess I really
need to know what VBA to put into the Excel form to look at teh last number
allocated to a project and just add one. If this can be done automagically on
selecting the required project then all the better.

I can get Access to allocate a sequential number to each new entry but not
to each new entry for an individual project. Does the make sense?

Your thoughts and help would be greatly appreciated.

Just let me nkow if you need any more information.

Rich

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Sequencial numbering

Hi Geoff,

That certainly give me somthing to ponder. Thanks for that, I can see where
your going with it.

I'll let you know how I get on.

many thanks,

Richard

"Geoff" wrote:

Hi Richard
This might point you in the right direction
The core of the solution I used recently doing a similar thing was Instr

Set tbl = Range("A1:A10")
For each c in tbl
'Get number of items in list and first and last row number
If Left(c, InStr(c, "-") - 1) = Left(orderID, InStr(orderID, "-") - 1) Then
sameidcntr = sameidcntr + 1
If sameidcntr = 1 Then firstsameid = c.Row
lastsameid = c.Row
End If

firstsameid to lastsameid is the range of the outer index you are seeking.
Then do:

Set tbl = Cells(lastsameid + rwcntr, Range("A1:A10").Column)
'Now add 1 to last inner index
newID = Left(tbl, InStr(tbl, "-") - 1) & "-" & Right(tbl, Len(tbl) -
InStr(tbl, "-")) + 1
neworderrow = lastsameid + 1 + rwcntr
rwcntr = rwcntr + 1

I was inserting a new line for each new id generated but this gives you the
general idea.

HTH

Geoff


"Richard Setford" wrote:

Hi there,

Bit of an Access/Excel newbie here in need of some help. First time in here
so please be gentle with me.

Here's what I'm trying to achieve. I want to build a database which records
the changes on a project with each project having it's own unique code based
on the year so for example:

05666
04555
03444

I've build the database itself and created an Excel front end form to input
the data to the database. What I would like to achieve is for each project
number to have it's own sequencial record number for example:

05666-1
05666-2
04555-1
04555-2
04555-3
03444-1
03444-2

you get the idea. How do I do this? It's really stumped me. I guess I really
need to know what VBA to put into the Excel form to look at teh last number
allocated to a project and just add one. If this can be done automagically on
selecting the required project then all the better.

I can get Access to allocate a sequential number to each new entry but not
to each new entry for an individual project. Does the make sense?

Your thoughts and help would be greatly appreciated.

Just let me nkow if you need any more information.

Rich

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sequencial page numbering of multiple tabs Phrank Excel Worksheet Functions 0 July 27th 11 04:06 AM
Import old dos sequencial data Rich Stone Excel Worksheet Functions 2 June 4th 10 03:32 PM
Sequencial FIXED Numbering ev Excel Discussion (Misc queries) 1 January 18th 10 04:26 PM
Sequencial file names Neville Excel Discussion (Misc queries) 1 February 14th 06 02:48 PM
offset problem list not sequencial steve alcock Excel Worksheet Functions 3 May 23rd 05 02:56 PM


All times are GMT +1. The time now is 03:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"