Question: Code block:

```py
class accinfo():
    def getfolowing(acclink):
        time.sleep(2)
        profileurl = "https://instagram.com/" + (acclink) + "/"
        browser.get(profileurl)
        time.sleep(2)
        wait.until(EC.visibility_of_element_located(
            (By.XPATH, '//*[@id="react-root"]/section/main/div/header/section/ul/li[3]/a/div'))).click()

        ##accinfo.scroldownflowng()
        following = []
        following = browser.find_elements(By.CLASS_NAME, 'notranslate._0imsa')
        for followin in following:
            print(followin.text)
        print(len(followin))

time.sleep(10)
accinfo.goprofile(hedefhesap, loginfo1)
accinfo.getfollower(hedefhesap)
accinfo.getfolowing(hedefhesap)

```

I'm gettin error, how can I fix it?

```
Traceback (most recent call last):
  File "C:/Users/ayarb/PycharmProjects/instagrambotv1/main.py", line 112, in <module>
    accinfo.getfolowing(hedefhesap)
  File "C:/Users/ayarb/PycharmProjects/instagrambotv1/main.py", line 62, in getfolowing
    print(len(followin))
UnboundLocalError: local variable 'followin' referenced before assignment

```

Answer: 
I think it is a better user experience to check as the user types not after the fact. Try something like this:

```
Option Explicit

Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
   If Not GoodKeyPress(KeyAscii) Then KeyAscii = 0
End Sub

Private Sub TextBox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
   If Not GoodKeyPress(KeyAscii) Then KeyAscii = 0
End Sub

Private Function GoodKeyPress(ByVal KeyAscii As MSForms.ReturnInteger) As Boolean
   If KeyAscii = 46 Then MsgBox "No decimal allowed"

   'allow only numbers, negative sign and backspace
   If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 45 Or KeyAscii = 8 Then GoodKeyPress = True
End Function

```
Is String Digits?
-----------------

**A Quick Fix**

```vb
' Below is the code to check for numbers
Dim j As Long
Dim cString As String

For j = 1 To 59
    cString = Me.Controls("TextBox" & j).Value
    If Len(cString) = 0 Then
        'MsgBox "At least one digit is necessary!", vbExclamation
    ElseIf Not (cString Like String(Len(cString), "#")) Then
        MsgBox "Only digits are allowed!", vbCritical
        Cancel = False ' ?
        Exit Sub
    Else ' valid input
    End If
Next j

```

**A Function**

* The `If` statement in the previous code is 'splitting' the following function's two operations.

```vb
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Purpose:      Returns a boolean indicating whether all characters of a string
'               are digits.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function IsDigits(ByVal S As String) As Boolean
    If Len(S) > 0 Then IsDigits = S Like String(Len(S), "#")
End Function

```