FrustratedEland
New Member
- Joined
- Jul 12, 2022
- Messages
- 4
- Office Version
- 365
- Platform
- Windows
Im very frustrated as I am sure that this is very simple, but I can't quite pull this one together!
I would like to check against a row of four values that start in A1 - if there is a 1, I would like the corresponding scrollbar (Bars 1 to 4) to be activated, and if there is a 0, to be disabled. I have something in mind along the lines below, and would grateful for any help! This version obviously isnt correct but I cannot find the right format to select the correct bar for the life of me - an earlier attempt didnt have any errors but was reading the bar values which was lovely but not really what I was after! Thank you .
I would like to check against a row of four values that start in A1 - if there is a 1, I would like the corresponding scrollbar (Bars 1 to 4) to be activated, and if there is a 0, to be disabled. I have something in mind along the lines below, and would grateful for any help! This version obviously isnt correct but I cannot find the right format to select the correct bar for the life of me - an earlier attempt didnt have any errors but was reading the bar values which was lovely but not really what I was after! Thank you .
VBA Code:
Private Sub EnableScrolls()
Dim i As Long
Dim Sc As ScrollBar
For i = 1 To 4
Sc = ("Bar" & i)
With Sheet1.Range("A1").Cells(1, i)
If Sheet1.Range("A1").Cells(1, i) = "1" Then
Sc.Enabled = True
Else
Sc.Enabled = False
End If
End With
Next i
End Sub