VBA Relative Referencing

Littlemalky

Board Regular
Joined
Jan 14, 2011
Messages
223
Ok, so here's the situation:

I have one static cell, in this case it's "F48" and I need it to equal the sum that I have at the bottom of another range of data. That range of data always changes in the amount of rows, however the columns are static. In column "J" is the part number, column "K" is the description, column "L" is the quantity, and the only purpose of column "M" is to label the total quantity at the very bottom of the data where everythign is summed.

I can't simply just do a sum formula in the F48 cell because of how everything is arranged and how it changes. Basically, I just need code that looks for the term "Polarized" in column "M", and takes the total quantity that is in the cell directly to the left of it, and copy that quantity into F48.

Any ideas?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Try

Code:
Sub test()
Dim Found As Range
Set Found = Columns("M").Find(what:="Polarized", LookIn:=xlValues, lookat:=xlWhole)
If Not Found Is Nothing Then Range("F48").Value = Found.Offset(, -1).Value
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,968
Messages
6,122,506
Members
449,089
Latest member
RandomExceller01

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