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

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Watch MrExcel Video

Forum statistics

Threads
1,112,796
Messages
5,542,552
Members
410,560
Latest member
1ndependent
Top