VBA Help : Counting System in Excel

Akw47

Board Regular
Joined
Nov 6, 2020
Messages
90
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Private Sub TextBox1_Change()

Dim c As Range, sAddr As String, i As Long

With ThisWorkbook.ActiveSheet
With .Range("B1", .Cells(.Rows.Count, "B").End(xlUp))
Set c = .Find(What:=CStr(TextBox1.Value), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows)
If Not c Is Nothing Then
sAddr = c.Address
Do
i = i + 1
Set c = .FindNext(c)
Loop While Not c Is Nothing And sAddr <> c.Address
End If
TextBox2.Value = i
End With
End With
End Sub

Hi I currently have this code, however, I want the textbox 2 value to +1, after typing the same number that can be found in the column B twice. Thanksss
 

Some videos you may like

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Watch MrExcel Video

Forum statistics

Threads
1,118,134
Messages
5,570,364
Members
412,320
Latest member
sixnine0312
Top