Combining Match and Offset in VBA

Endrik

New Member
Joined
Jan 22, 2014
Messages
3
I have not received any feedback to my initial question, so I thought I would ask to see if anybody can help me come up with a different solution using a Match and Offset combination in VBA.

I need to be able to search for a certain value in column B, then activate the cell to the right of that value in column C. (Once activated I will be using this code to add a count to the value in column C:

x = ActiveCell.Value
ActiveCell.Value = x + 1

The problem I am having is activating the cell in Column C. Can anyone tell me how to write a function in VBA that would allow me to search the values in Column B, find the value I am looking for, then activate the cell next to it in Column C so I can then increase the count in that cell?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi - try this.

Code:
Sub test()

valToFind = 11

numRow = Application.Match(valToFind, Range("B:B"), 0)

If IsError(numRow) = False Then
    Range("C1").Offset(numRow - 1).Select
Else
    MsgBox ("No Matches")
End If


End Sub

Dean.
 
Upvote 0
Thanks Dean! You are an absolute lifesaver! I have been beating my head against a wall for a week trying to get this to work. Thank you so much for taking the time to reply. Very much appreciated!
 
Upvote 0

Forum statistics

Threads
1,203,472
Messages
6,055,610
Members
444,803
Latest member
retrorocket129

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