VBA code to find the value of cells

Status
Not open for further replies.

Akw47

Board Regular
Joined
Nov 6, 2020
Messages
90
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi currently I have this code
VBA Code:
Private Sub TextBox1_Change()
    Dim c As Range
    If Len(TextBox1.Value) >= 5 Then
            If c in ThisWorkbook.ActiveSheet.Range("D1", .Cells(.rows.Count, "D").End(x1Up)) Then
             If InStr(c, "/") > 0 Or InStr(c, ",") > 0 Then
                    If MsgBox("Please confirm cell " & c.Address, vbYesNo, "Double Check") = vbNo Then Exit Sub
            End If
        End If
    End If
End Sub
But there is a error at the "if c in thisworkbook" statement. I want MsgBox to pop out when my the 5 digit number in textbox1 match with the same number in column D with a "/" or "," with it
 
@Akw47, you are starting multiple threads with the same issue providing code from others that's changed in a way it shouldn't, causing you errors.
This approach is almost like cross posting and makes it unattractive for others (at least for me) to lend a helping hand ...

 
Upvote 0

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
@Akw47, you are starting multiple threads with the same issue providing code from others that's changed in a way it shouldn't, causing you errors.
This approach is almost like cross posting and makes it unattractive for others (at least for me) to lend a helping hand ...

GWteB I am so sorry for this but how do I go about it, next time when I try to adjust the code myself and gets stuck with a problem. Please advise. I really didn't mean to cross post or get you offended :( I am sorry
 
Upvote 0
Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread. Per forum rules, posts of a duplicate nature will be locked or deleted (rule 12 here: Forum Rules).

If you do not receive a response, you can "bump" it by replying to it again, though we advise you to wait 24 hours before doing and not to bump a thread more than once a day.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,214,951
Messages
6,122,449
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top