mikejacobs
New Member
- Joined
- May 21, 2018
- Messages
- 3
Hey guys, I just started using VBA and I keep getting type mismatch error from the code below
I am trying to search a worksheet called Mock in the column E for the number 46361 (I hard coded it that number for testing purposes) and return the row number (in this case, 2). I know for certain that the number exists in E2.
Code:
Dim testMock As Variant
Dim wb As Workbook: Set wb = ThisWorkbook
Dim Mock1 As Worksheet
Set Mock1 = ThisWorkbook.Worksheets("Mock")
Dim testnum As Variant
testnum = 46361
testMock = Mock1.Application.Match(testnum, "E2:E100", 0)
MsgBox (testMock)
I am trying to search a worksheet called Mock in the column E for the number 46361 (I hard coded it that number for testing purposes) and return the row number (in this case, 2). I know for certain that the number exists in E2.