Range Value only certain formulas in a range?

neov

Board Regular
Joined
Oct 3, 2003
Messages
67
I have a range of data that comes from Vlookups....in column A are the department/account numbers, columns b - k are totals for Jan - Dec, and each department has subsets, for example, rows 2-5 are payroll related, row 6 is a subtotal for that subset, then rows 7-10 are another subset, etc etc...

What I'd like to do is have a macro that performs a copy/paste special/value function ONLY on the cells that have a vlookup, leaving the sum's that make up the subtotals for each month intact...

Is this possible?

Thanks in advance.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hi,

Try:

Code:
Sub xxx()
Dim ce As Range
For Each ce In Range("B2:K20")
If Left(ce.Formula, 8) = "=VLOOKUP" Then ce = ce.Value
Next ce
End Sub
 
Upvote 0

Forum statistics

Threads
1,222,170
Messages
6,164,378
Members
451,886
Latest member
elpepe1970

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