spin button help

yves_sater

New Member
Joined
Jul 29, 2010
Messages
15
i would like to do smthg like this:

Option Explicit

Private Sub ListBox1_Change()
Dim I As Integer
For I = 1 To 4
Me.Controls("TextBox" & I).Value = Range("A" & ListBox1.ListIndex + 2).Offset(, I)
Next I
End Sub

Private Sub SpinButton1_Change()
If ListBox1.ListIndex <> ListBox1.ListCount - 1 Then
ListBox1.ListIndex = SpinButton1.Value
Else
ListBox1.ListIndex = 0
SpinButton1.Value = 0
End If
End Sub
Private Sub UserForm_Initialize()
Dim LastRow As Long
LastRow = Range("A" & Rows.Count).End(xlUp).Row

ListBox1.RowSource = "A2:A" & LastRow

SpinButton1.Min = 0
SpinButton1.Max = LastRow

End Sub

by using only one spin button i can scroll down and up all vlaues of the textboxes and comboboxes that i have in my userform....can anyone help me plz
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

yves_sater

New Member
Joined
Jul 29, 2010
Messages
15
So all i nedd is by using only one spin button in a userform...i can scroll down and up all values in textboxes and comboboxes i have in this userform...
it can be if u want similar to a "Next" and "Previous" command button but because i have a lot of rows and datas..so the spin button will be easier for me to scrolldown adn up all the values i want till i reach the last value entered
 

bobsan42

Well-known Member
Joined
Jul 14, 2010
Messages
1,343
sorry but i think you did not provide enough information.
Where and what is the problem?
is it possible to provide the workbook (upload it somewhere public and post the link) or give more details?
 

yves_sater

New Member
Joined
Jul 29, 2010
Messages
15

ADVERTISEMENT

im gonna try to explain it...

i have a worksheet full with data with tiles such as:

PO# (A6) Item (B6) Supplier (C6)
Numbers(TXT) Name of the item(TXT) Name of suplier(Combo)

Project (D6) Delivery (E6) Project (F6)
Name of the project(Combo) Type of delivery (Combo) Name of the proejct (Combo)

i have a userform to be able to enter data in these fields

I want a spinbutton in this form ..instead of pushing on a next button...i want to scroll down and up the values in these Textboxes and comboboxes..
 

bobsan42

Well-known Member
Joined
Jul 14, 2010
Messages
1,343
yes i think i understand this
but i (and mybe everyone here) don't know just like this what is the problem with your code.
to test it is the best way, but for this i have to rebuild your file contents (more or less), your form with all controls, your code - and then see where is the problem.
it's much easier if we can all simply look at the file. i did send a PM with my e-mail.
if you send it to me i will upload it and then post the link to the file if you don't mind.
 

bobsan42

Well-known Member
Joined
Jul 14, 2010
Messages
1,343

ADVERTISEMENT

not really sure but why don't try to replace
Private Sub SpinButton1_Change()
with
Private Sub SpinButton1_AfterUpdate()

i think i just got your mail - will check now.
 

yves_sater

New Member
Joined
Jul 29, 2010
Messages
15
the formula i put in this threat at first, isnt included in my workbook...i got it from the internet and it does wat i want but it s not customized to my workbook
 

bobsan42

Well-known Member
Joined
Jul 14, 2010
Messages
1,343
are we talking about Userform1?
which controls do you want to update with the spin button?
 

yves_sater

New Member
Joined
Jul 29, 2010
Messages
15
yes in userform1..i want all these textboxes and comboboxes...,,to be linked to one spinbutton that will have the function of Next and Previous..
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,821
Messages
5,513,587
Members
408,962
Latest member
DCESL

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top