Hi everyone
VBA is my weakest link and I really struggle with the basics, but I am determined not to let it beat me. I have atable of data which I can search and dispaly the results in a scrollable list. I have written a small piece of code
[pre]
[/pre]
This changes the settings of the scrollbar so if I find 1 record is sets the scrollbar to small values and if I find all records say using * then it increases the values the scroll bar uses.
However I have been trying to write a bit more code that will reset the scrollbar to top rather than leaving it where is last position is or was. That is where I am coming unstuck.
I have posted a sample of my file on Dropbox and would appreciate any improvements or solution to my problem of course if it is possible to do what I am querying.
https://www.dropbox.com/s/hm5n9k5lneyp7gg/Book1.xlsm
Ian M
VBA is my weakest link and I really struggle with the basics, but I am determined not to let it beat me. I have atable of data which I can search and dispaly the results in a scrollable list. I have written a small piece of code
[pre]
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'On Error GoTo Exitsub
Dim shp As Shape
Select Case Target.Address
Case Me.Range("KeyWord").Address
Set shp = Me.Shapes("ScrollResults")
With shp
If Me.Range("NbRecFound") > 10 Then
.ControlFormat.Max = Me.Range("NbRecFound") - 10
Else
.ControlFormat.Max = Me.Range("NbRecFound")
End If
End With
Set shp = Nothing
End Select
End Sub
This changes the settings of the scrollbar so if I find 1 record is sets the scrollbar to small values and if I find all records say using * then it increases the values the scroll bar uses.
However I have been trying to write a bit more code that will reset the scrollbar to top rather than leaving it where is last position is or was. That is where I am coming unstuck.
I have posted a sample of my file on Dropbox and would appreciate any improvements or solution to my problem of course if it is possible to do what I am querying.
https://www.dropbox.com/s/hm5n9k5lneyp7gg/Book1.xlsm
Ian M