Hi all,
I suspect the answer to this will be no, but I'll ask anyway. I am using a Spin Button to move data up/down a list, and I have written some code (below) that identifies wheter or not the selected item is top/botom of the list. If it is, I would like to disable the option to spin up/down, but I can only find an option to disble the the button as a whole. Is there another option to do this or will I have to write some code to stop it working in these situations.
Thanks.
The code that I use to identify options on the top/bottom of the list. This Macro is activated by an _change event on the UserForm.
Sub SpinButtonActivation()
Dim ItemToCheck As String ' The item to be checked within the list
ItemToCheck = Options.txtListOptions.Text
Set RngFound = Range("AY:AY").Find(ItemToCheck, LookIn:=xlFormulas, LookAt:=xlWhole, MatchCase:=False)
If Not RngFound Is Nothing Then
iRow = Sheets(1).Cells(Rows.Count, 51).End(xlUp).Offset(1, 0).Row - 1
If RngFound.Row = 2 Then ' Spin Up is disabled if top row is selected
Options.spinListOptions.Enabled = False
ElseIf RngFound.Row = iRow Then ' Spin Up is disabled if bottom row is selected
Options.spinListOptions.Enabled = False
Else: Options.spinListOptions.Enabled = True
End If
End If
End Sub
Bookmarks