Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All........
This code works fine for a text string as "oldest", but I want it to work if the cell value is #VALUE! (basically, clear or delete the row is the #VALUE! error is found) Dim oldest As String oldest = Range("data!k1").Value 'value is a text string With Sheets("ALL12") lastrow = .Cells(.Rows.Count, "a").End(xlUp).Row For r = lastrow To 12 Step -1 If .Cells(r, "b").Value Like oldest Then .Rows(r).EntireRow.ClearContents End If Next r End With Any help would be much appreciated....... Vaya con Dios, Chuck |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try
If .Cells(r, "b").Text = "#VALUE!" Then -- Jacob "clr" wrote: Hi All........ This code works fine for a text string as "oldest", but I want it to work if the cell value is #VALUE! (basically, clear or delete the row is the #VALUE! error is found) Dim oldest As String oldest = Range("data!k1").Value 'value is a text string With Sheets("ALL12") lastrow = .Cells(.Rows.Count, "a").End(xlUp).Row For r = lastrow To 12 Step -1 If .Cells(r, "b").Value Like oldest Then .Rows(r).EntireRow.ClearContents End If Next r End With Any help would be much appreciated....... Vaya con Dios, Chuck . |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How cool it is!..........works perfect!
You are a Prince, kind Sir...........thank you very much. Vaya con Dios, Chuck, CABGx3 "Jacob Skaria" wrote in message ... Try If .Cells(r, "b").Text = "#VALUE!" Then -- Jacob "clr" wrote: Hi All........ This code works fine for a text string as "oldest", but I want it to work if the cell value is #VALUE! (basically, clear or delete the row is the #VALUE! error is found) Dim oldest As String oldest = Range("data!k1").Value 'value is a text string With Sheets("ALL12") lastrow = .Cells(.Rows.Count, "a").End(xlUp).Row For r = lastrow To 12 Step -1 If .Cells(r, "b").Value Like oldest Then .Rows(r).EntireRow.ClearContents End If Next r End With Any help would be much appreciated....... Vaya con Dios, Chuck . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
vb code to clearcontents of a merged cell | Excel Programming | |||
ClearContents | Excel Programming | |||
Find * in a cell & ClearContents | Excel Programming | |||
Change the appearance cell where Find criteria is found in a cell | Excel Discussion (Misc queries) | |||
clearcontents, worksheet_change, cell validation | Excel Programming |