LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Userform to increment line item numbers with textboxes-spinbuttons

I use the following code with a userform to renumber line item numbers that
get changed. My UF has two spinbuttons with two textboxes that update each
other for a starting and ending line item number. I need help with just this
part that looks at those two entries to change and increment the line number
by one from the starting line no. to the ending line number. These can be
something like "1" to "8" or "9" to "16" etc. H becomes the starting line
number and the other variables that should increment but don't. I am
modifying older code that works but is not as efficient that does not use the
loop routine.

Any help is much appreciated.

Private Sub cmdOK_Click()
Dim H As Integer, lineno As Integer, newno As Integer

ActiveCell.Activate
ActiveCell.FormulaR1C1 = TextBox1.Value
ActiveCell.Offset(RowOffset:=1, ColumnOffset:=0).Activate
Selection.ClearContents
H = TextBox1.Value 'from textbox1 on userform1
Do Until lineno = TextBox2.Value 'value in textbox2 on userform1
lineno = H
ActiveCell.Offset(RowOffset:=4, ColumnOffset:=0).Activate
ActiveCell.FormulaR1C1 = H + newno
newno = 1
ActiveCell.Offset(RowOffset:=1, ColumnOffset:=0).Activate
Selection.ClearContents
newno = H + newno
Loop
Exit Sub


End Sub
 
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
Item numbers result in item description in next field in Excel Cheryl MM Excel Worksheet Functions 1 February 20th 07 03:51 PM
Userform- Formating numbers in Textboxes Ozgur Pars[_2_] Excel Programming 4 July 6th 06 10:01 AM
userform & textboxes beginner Excel Programming 3 July 27th 04 10:56 AM
userform textboxes again Jo[_6_] Excel Programming 4 October 21st 03 07:25 PM
add numbers in textboxes on userform KimberlyC Excel Programming 5 September 18th 03 06:15 AM


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