View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Macro to look for where vLookup has a result then paste value

Dim myRng as range
dim myCell as range

with worksheets("SomeSheetNameHere")
set myrng = .range("B2",.cells(.rows.count,"B").end(xlup))
end with

for each mycell in myrng.cells
if mycell.value = "" _
or mycell.value = "-" then
'do nothing
else
mycell.value = mycell.value
end if
next mycell

If figured you'd want to keep the hyphens and the blanks.

I wonder what you want to happen if 0 is returned because the sending cell is
empty?



Aposto wrote:

I'm looking for a macro to look for cells in a column where a vlookup formula
has returned a value other than blank, and then paste the result in that same
cell thus removing the formula. If the value is blank then I want to keep the
formula.
=IF(V6="","-",VLOOKUP(V6,'[AMS Crew list.xls]Crew Info table'!$A:$E,2,FALSE))


--

Dave Peterson