Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Spin Button's What can they do?

I have populated several Textboxes by a listbox selection, ALL duplicate entries have been removed
from the listbox.

The textbox shows data in the same row as the selected Listbox.value.
But as there may be more than 1 matching value to the listbox(not displayed as duplicates are
removed),
what does a SPIN BUTTON do ?
If i place it next to a Textbox, can i set it to Scroll through the other records ?
I have NEVER used a Spin Button and can onlu assume it could do this.
How do i set it to this, if it can do this?
The code i use to populate the textboxes is he

Private Sub ListBox2_Click()
Application.ScreenUpdating = False
Dim LastCell As Long
Dim myrow As Long
On Error Resume Next
LastCell = Worksheets("Data").Cells(Rows.Count, "A").End(xlUp).Row

With ActiveWorkbook.Worksheets("Data")
..Select
For myrow = 1 To LastCell
If .Cells(myrow, 1) < "" Then
If .Cells(myrow, 1).Offset(0, 59).Value = ListBox2.Value Then
TextBox1.Value = "A " & Cells(myrow, 1)
TextBox2.Value = Cells(myrow, 43)
TextBox3.Value = Cells(myrow, 19)
TextBox4.Value = Cells(myrow, 20)
End If
End If
Next
End With
Application.ScreenUpdating = True

End Sub

Corey....


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Spin Button's What can they do?

a spinbutton just increments or decrements its value. You use this value as
you wish

create a blank userform in a new workbook and put a spinbutton on it.
(spinbutton1) and a textbox on it (textbox1)


put it code like this

Private Sub SpinButton1_SpinDown()
Textbox1.Text = SpinButton1.Value
End Sub

Private Sub SpinButton1_SpinUp()
Textbox1.Text = SpinButton1.Value
End Sub


The spinbutton has max and min values. Assume you wanted to walk up and
down in column A from A5 to A15

Private Sub Userform_Initialize()
SpinButton1.Max = 15
SpinButton1.Min = 5
End sub
Private Sub SpinButton1_SpinDown()
Textbox1.Text = worksheets("Sheet1").Cells(SpinButton1.Value,"A"). Value
End Sub

Private Sub SpinButton1_SpinUp()
Textbox1.Text = worksheets("Sheet1").Cells(SpinButton1.Value,"A"). Value
End Sub

--
Regards,
Tom Ogilvy


"Corey" wrote in message
...
I have populated several Textboxes by a listbox selection, ALL duplicate
entries have been removed
from the listbox.

The textbox shows data in the same row as the selected Listbox.value.
But as there may be more than 1 matching value to the listbox(not
displayed as duplicates are
removed),
what does a SPIN BUTTON do ?
If i place it next to a Textbox, can i set it to Scroll through the other
records ?
I have NEVER used a Spin Button and can onlu assume it could do this.
How do i set it to this, if it can do this?
The code i use to populate the textboxes is he

Private Sub ListBox2_Click()
Application.ScreenUpdating = False
Dim LastCell As Long
Dim myrow As Long
On Error Resume Next
LastCell = Worksheets("Data").Cells(Rows.Count, "A").End(xlUp).Row

With ActiveWorkbook.Worksheets("Data")
.Select
For myrow = 1 To LastCell
If .Cells(myrow, 1) < "" Then
If .Cells(myrow, 1).Offset(0, 59).Value = ListBox2.Value Then
TextBox1.Value = "A " & Cells(myrow, 1)
TextBox2.Value = Cells(myrow, 43)
TextBox3.Value = Cells(myrow, 19)
TextBox4.Value = Cells(myrow, 20)
End If
End If
Next
End With
Application.ScreenUpdating = True

End Sub

Corey....




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
Spin box increase value only Mark N Excel Discussion (Misc queries) 1 August 27th 09 03:51 PM
Can Multiple Range Pivot Table's field button's caption be changed Jac Excel Discussion (Misc queries) 1 June 10th 07 11:09 AM
how to increase size of button's image of custom toolbar of Excel Padam Excel Programming 0 August 7th 06 03:39 PM
New spin on old problems Arlen[_2_] Excel Programming 9 January 16th 04 06:46 PM
Spin Button Andrew[_14_] Excel Programming 1 July 18th 03 01:51 AM


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