Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clear cells with #N/A


I'm using paste/special to remove vlookup functions which leave #N/A
when no matches were found. I'm not getting any errors but I can't get
the current cell to clear if it has the #N/A. Can anyone assist?
Thanks in advance!

For i = 7 To lastRow
If (CStr(Cells(i, "L").Value) = "#N/A") Then
Cells(i, "L").Value.Clear
End If
Next i


--
mthomas
------------------------------------------------------------------------
mthomas's Profile: http://www.excelforum.com/member.php...o&userid=25649
View this thread: http://www.excelforum.com/showthread...hreadid=393138

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Clear cells with #N/A

On Error Resume Next
Columns(12).SpecialCells(xlFormulas,xlErrors).Clea r
Columns(12).SpecialCells(xlConstants,xlErrors).Cle ar
On Error goto 0

--
Regards,
Tom Ogilvy

"mthomas" wrote in
message ...

I'm using paste/special to remove vlookup functions which leave #N/A
when no matches were found. I'm not getting any errors but I can't get
the current cell to clear if it has the #N/A. Can anyone assist?
Thanks in advance!

For i = 7 To lastRow
If (CStr(Cells(i, "L").Value) = "#N/A") Then
Cells(i, "L").Value.Clear
End If
Next i


--
mthomas
------------------------------------------------------------------------
mthomas's Profile:

http://www.excelforum.com/member.php...o&userid=25649
View this thread: http://www.excelforum.com/showthread...hreadid=393138



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Clear cells with #N/A

Try this

For i = 7 To lastRow
If IsError(Cells(i, "L")) Then
Cells(i, "L").Value.Clear
End If
Next i




*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default Clear cells with #N/A

Have you tried altering your formula:

=If(Countif(lookupColumn,lookupValue)0,Vlookup(.. ...),"")

this leaves the cell looking like it is blank.
or you can change "" to 0, or .......

--
steveB

Remove "AYN" from email to respond
"mthomas" wrote in
message ...

I'm using paste/special to remove vlookup functions which leave #N/A
when no matches were found. I'm not getting any errors but I can't get
the current cell to clear if it has the #N/A. Can anyone assist?
Thanks in advance!

For i = 7 To lastRow
If (CStr(Cells(i, "L").Value) = "#N/A") Then
Cells(i, "L").Value.Clear
End If
Next i


--
mthomas
------------------------------------------------------------------------
mthomas's Profile:
http://www.excelforum.com/member.php...o&userid=25649
View this thread: http://www.excelforum.com/showthread...hreadid=393138



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clear cells with #N/A


I appreciate the replies guys, but just an FYI. I decided to use the
replace method for the column and it worked great!

Columns("D:D").Select
Selection.Replace What:="#N/A", Replacement:="", _
SearchOrder:=xlByRows, MatchCase:=False

Appreciate ya and thanks for the help....


--
mthomas
------------------------------------------------------------------------
mthomas's Profile: http://www.excelforum.com/member.php...o&userid=25649
View this thread: http://www.excelforum.com/showthread...hreadid=393138

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
Clear cells automatically bigmaas Excel Discussion (Misc queries) 7 March 3rd 10 04:13 PM
Cells.Clear Ben Dummar Excel Discussion (Misc queries) 3 January 24th 07 10:50 PM
clear contents cells of unprotected cells Ed Excel Programming 6 January 12th 06 06:09 PM
Clear Cells Mike Excel Discussion (Misc queries) 4 November 20th 05 11:50 PM
Clear cells range if certain cells are all empty gschimek - ExcelForums.com Excel Programming 6 May 13th 05 10:38 PM


All times are GMT +1. The time now is 11:05 AM.

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

About Us

"It's about Microsoft Excel"