Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Need help...vlookup "type mismatch"

So...my goal is to write a macro that will copy-paste values on all
cells in a selection that a vlookup returns a value 0...and leave
the formula in the rest.

I get a type mismatch with the following code because of the vlookup
formula (even when a value is returned)

For Each cell In Selection
If cell.Value 0 Then
cell.Copy
cell.PasteSpecial Paste:=xlValues
Next cell
Application.CutCopyMode = False



any suggestions?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Need help...vlookup "type mismatch"

For Each cell In Selection
if not iserror(cell) then
If cell.Value 0 Then _
cell.formula = cell.Value
end if
Next cell


--
Regards,
Tom Ogilvy


" wrote:

So...my goal is to write a macro that will copy-paste values on all
cells in a selection that a vlookup returns a value 0...and leave
the formula in the rest.

I get a type mismatch with the following code because of the vlookup
formula (even when a value is returned)

For Each cell In Selection
If cell.Value 0 Then
cell.Copy
cell.PasteSpecial Paste:=xlValues
Next cell
Application.CutCopyMode = False



any suggestions?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Type mismatch" when I try to fill an Array variable with "+" [email protected] Excel Discussion (Misc queries) 1 April 17th 07 01:28 PM
Error Handling to mitigate "Run Time Erorr 13 Type Mismatch" ExcelMonkey Excel Programming 3 October 16th 05 01:56 PM
"FIND" generates "Type mismatch" error quartz[_2_] Excel Programming 5 November 16th 04 03:29 PM
Copying data to another worksheet gives "Type Mismatch" error TB[_3_] Excel Programming 6 July 28th 03 12:44 PM


All times are GMT +1. The time now is 11:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"