Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default last cell plus one


Hi, I have a user form to add jobs to my worksheet, each job has a job
number which run in a list down the A column, the problem is you have
to type the new job number in manual in the text box on the userform for
ever new job..

Is the away to make it look down the list in column A for the last
one and then +1 onto it and auto load it into the job textbox on my
userform?

Thanks Clare


--
clarefoxly
------------------------------------------------------------------------
clarefoxly's Profile: http://www.excelforum.com/member.php...o&userid=24183
View this thread: http://www.excelforum.com/showthread...hreadid=384541

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default last cell plus one

Try something like this...

txtMyTextbox.text = sheets("Sheet1").range("A65536").end(xlUp).value + 1

This assumes that you have numbers in column A. An error will be generated
otherwise.
--
HTH...

Jim Thomlinson


"clarefoxly" wrote:


Hi, I have a user form to add jobs to my worksheet, each job has a job
number which run in a list down the A column, the problem is you have
to type the new job number in manual in the text box on the userform for
ever new job..

Is the away to make it look down the list in column A for the last
one and then +1 onto it and auto load it into the job textbox on my
userform?

Thanks Clare


--
clarefoxly
------------------------------------------------------------------------
clarefoxly's Profile: http://www.excelforum.com/member.php...o&userid=24183
View this thread: http://www.excelforum.com/showthread...hreadid=384541


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default last cell plus one

With Worksheets("Sheet1")
Textbox1.Text = Cstr(.Range("A1").Offset(.Cells(Rows.Count,
"A").End(xlUp).Row - 1, 0).Value)
End With


--

HTH

RP
(remove nothere from the email address if mailing direct)


"clarefoxly" wrote
in message ...

Hi, I have a user form to add jobs to my worksheet, each job has a job
number which run in a list down the "A" column, the problem is you have
to type the new job number in manual in the text box on the userform for
ever new job..

Is the away to make it look down the list in column 'A' for the last
one and then +1 onto it and auto load it into the job textbox on my
userform?

Thanks Clare


--
clarefoxly
------------------------------------------------------------------------
clarefoxly's Profile:

http://www.excelforum.com/member.php...o&userid=24183
View this thread: http://www.excelforum.com/showthread...hreadid=384541



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default last cell plus one


thank you guys for your help,

Private Sub UserForm_Initialize()
g = Application.WorksheetFunction.CountA(Range("A:A"))
a = Cells(g, 1)
Label1.Caption = a + 1
End Sub

works fine for a number list, but my list for example looks like,

P011110
P011111
P011112
P01111... so on

is it possable to make this work with a letter at the start of the list
or if i put the P on its own in column A, can this then be made to work
on column B on the 11110 part, iv tryed this myself but cant seem to
get it to work with column B ?

Thanks Clare.


--
clarefoxly
------------------------------------------------------------------------
clarefoxly's Profile: http://www.excelforum.com/member.php...o&userid=24183
View this thread: http://www.excelforum.com/showthread...hreadid=384541

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default last cell plus one


Hi Clare

No need to do that. Change your third line thus:

Label1.Caption = "P0" & a + 1

or

TextBox1.Value = "P0" & a + 1

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=384541



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default last cell plus one


Hi, rite the best iv had is it being able to add onto list like P01,
P02
But cant seem to get it to work for a list like P01236.

Iv include the a sample file so you can see what I mean.
the file anit ziped but just has the extention is changed, so just take
the .zip off

Thanks for the help DominicB

Clare.


+-------------------------------------------------------------------+
|Filename: last cell plus one.xls.zip |
|Download: http://www.excelforum.com/attachment.php?postid=3576 |
+-------------------------------------------------------------------+

--
clarefoxly
------------------------------------------------------------------------
clarefoxly's Profile: http://www.excelforum.com/member.php...o&userid=24183
View this thread: http://www.excelforum.com/showthread...hreadid=384541

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default last cell plus one


Hi Clare

I've fixed the problem you were having.
Full explanation on the file.

HTH

DominicB


+-------------------------------------------------------------------+
|Filename: last cell plus one.xls.zip |
|Download: http://www.excelforum.com/attachment.php?postid=3577 |
+-------------------------------------------------------------------+

--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=384541

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default last cell plus one


Good afternoon ClareFoxly

There is but we'll make a few assumptions as you've not given much
information in your post.

Private Sub UserForm_Initialize()
g = Application.WorksheetFunction.CountA(Range("A:A"))
a = Cells(g, 1)
Label1.Caption = a + 1
End Sub

Paste the code above into your userform's code section. This will look
for the last row in column A and insert the value of the last row + 1
into a label called Label1.
To insert the value into a text box, use this as the second to the last
line:

TextBox1.Value = a + 1

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=384541

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
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options Yuvraj Excel Discussion (Misc queries) 0 June 29th 09 11:20 AM
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Yuvraj Excel Discussion (Misc queries) 0 June 26th 09 06:01 PM
Populate a cell if values in cell 1 and cell 2 match cell 3 and 4 [email protected] Excel Worksheet Functions 1 August 22nd 08 02:04 AM
How to create/run "cell A equals Cell B put Cell C info in Cell D abmb161 Excel Discussion (Misc queries) 5 January 26th 06 06:36 PM
data validation to restrict input in cell based on value of cell above that cell NC Excel Programming 2 January 25th 05 07:11 AM


All times are GMT +1. The time now is 12:36 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"