Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Next Number in Sequence

VBA Novice

Using VBA I want to know what Account code was last iputted (used) in a
given sequence within a column so the user know the next number to use (Users
are inputting via userforms so cannot see the spreadsheet.

Therefore if column A as codes SAT1, SAT2, SAT3 etc I want to able via a
msgbx to notify the users that SAT3 was the last Account code to be used and
therefore user SAT4 should be used next.

Obviously this will only be used when the user hits a command button titled
next availble account.

Many thanks

M
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Next Number in Sequence

Assuming the last populated cell would contain that number

Dim rng as Range, nextNumber as Long
set rng = Cells(rows.count,"A").End(xlup)
nextNumber = "SAT" & clng(Right(rng,len(rng)-3)) + 1
msgbox nextNumber

--
Regards,
Tom Ogilvy


"Mr M Walker" wrote in message
...
VBA Novice

Using VBA I want to know what Account code was last iputted (used) in a
given sequence within a column so the user know the next number to use

(Users
are inputting via userforms so cannot see the spreadsheet.

Therefore if column A as codes SAT1, SAT2, SAT3 etc I want to able via a
msgbx to notify the users that SAT3 was the last Account code to be used

and
therefore user SAT4 should be used next.

Obviously this will only be used when the user hits a command button

titled
next availble account.

Many thanks

M



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Next Number in Sequence

Unfortunatley the code maynot be at the bottom because we have a number of
differenct code make-ups. Is there anyway of doing the below if the code sit
in the middle of the spreadsheet.

Marcus

"Tom Ogilvy" wrote:

Assuming the last populated cell would contain that number

Dim rng as Range, nextNumber as Long
set rng = Cells(rows.count,"A").End(xlup)
nextNumber = "SAT" & clng(Right(rng,len(rng)-3)) + 1
msgbox nextNumber

--
Regards,
Tom Ogilvy


"Mr M Walker" wrote in message
...
VBA Novice

Using VBA I want to know what Account code was last iputted (used) in a
given sequence within a column so the user know the next number to use

(Users
are inputting via userforms so cannot see the spreadsheet.

Therefore if column A as codes SAT1, SAT2, SAT3 etc I want to able via a
msgbx to notify the users that SAT3 was the last Account code to be used

and
therefore user SAT4 should be used next.

Obviously this will only be used when the user hits a command button

titled
next availble account.

Many thanks

M




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Next Number in Sequence

See answer to later posting of this question.

--
Regards,
Tom Ogilvy

"Mr M Walker" wrote in message
...
Unfortunatley the code maynot be at the bottom because we have a number of
differenct code make-ups. Is there anyway of doing the below if the code

sit
in the middle of the spreadsheet.

Marcus

"Tom Ogilvy" wrote:

Assuming the last populated cell would contain that number

Dim rng as Range, nextNumber as Long
set rng = Cells(rows.count,"A").End(xlup)
nextNumber = "SAT" & clng(Right(rng,len(rng)-3)) + 1
msgbox nextNumber

--
Regards,
Tom Ogilvy


"Mr M Walker" wrote in message
...
VBA Novice

Using VBA I want to know what Account code was last iputted (used) in

a
given sequence within a column so the user know the next number to use

(Users
are inputting via userforms so cannot see the spreadsheet.

Therefore if column A as codes SAT1, SAT2, SAT3 etc I want to able via

a
msgbx to notify the users that SAT3 was the last Account code to be

used
and
therefore user SAT4 should be used next.

Obviously this will only be used when the user hits a command button

titled
next availble account.

Many thanks

M






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
Looking for next number in sequence Alex.W Excel Discussion (Misc queries) 3 January 30th 09 12:40 AM
Row Number out of Sequence JudithJubilee Excel Discussion (Misc queries) 3 October 1st 08 02:15 PM
How can I match a random number with closest number from sequence? Matt Excel Worksheet Functions 4 August 3rd 06 01:22 AM
Number sequence Brento Excel Discussion (Misc queries) 3 July 15th 06 11:41 PM
number sequence gap Judi Mason Excel Worksheet Functions 1 January 16th 06 07:08 PM


All times are GMT +1. The time now is 02:49 AM.

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

About Us

"It's about Microsoft Excel"