View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default How create blank cell value as the result of Excel "IF" function?

Let's say we have data from A1 thru A100, but there are some blanks in it.

We want to copy column A to column B, but not the blanks in column A.

So if A10 is blank, don't copy it over.


Sub copy_no_blanks()
For i = 1 To 100
If Cells(i, "A") = "" Then
Else
Cells(i, "A").Copy Cells(i, "B")
End If
Next
End Sub

--
Gary''s Student
gsnu200710


"Pocket Protector as a Fashion Statement" wrote:

How can I best create blank cell value as the result of the Excel "IF"
sorksheet function?

That would be useful "Paste Special" a column or row of the results over an
existing column of entries, while skipping blanks, to over-write only the
cells for which the results are non-blank.