Finding the address of a matched cell with VBA

PoroBro

New Member
Joined
Jul 3, 2018
Messages
3
Hey.

I need to change the below cell code into VBA code.
=ADDRESS($O$7;MATCH(K7;'3rd exercise'!3:3;0))

Just to clarify, I am trying to remove unnecessary cells from the worksheets, so all the cell references are already variables in the code, except for the '3rd exercise'!3:3 as it is a value that has to be looked for.

I am new to VBA so if you can add anything to clarify how everything works, I'd love it. Thanks upfront!
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Assuming you have the value from $O$7 stored in a variable called rowNum and you have the value from K7 stored in a variable called findVal then it would be something like this:

Code:
rowNum = Range("O7").Value
findVal = Range("K7").Value
cellAddress = Cells(rowNum, Application.Match(findVal, Sheets("3rd exercise").Range("3:3"), 0)).Address

I haven't run or tested this code however.

WBD
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,818
Members
449,049
Latest member
cybersurfer5000

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