View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Trevor Shuttleworth Trevor Shuttleworth is offline
external usenet poster
 
Posts: 1,089
Default How do I skip a blank cell within macro?

Dim K as Variant
K = 0
For F = 1 To 250
If Range("A" & F) < "" Then
Range("B" & F).FormulaR1C1 = "=IF(RC[-3]="""",0,IF(RC[1]="""",1,0))"
End If
K = K + 1
Next F

"DJ Dusty" wrote in
message ...

I have the following for...next loop:

-Dim K as Variant
K = 0
For F = 1 To 250
Range("B" & K).Select
ActiveCell.FormulaR1C1 = "=IF(RC[-3]="""",0,IF(RC[1]="""",1,0))"
K = K + 1
Next F-

Basically, if *Range("A" & F)* was blank, I don't want the formula to
be entered in column B. So, something like:

*IF Range("A" & F)="" Then K = K + 1; Next F* ...or something similar.
How do I do it?

I'm fairly new to VBA programming, so bear with me!

(BTW - please don't question the K variant, just go with it. It's part
of a longer routine, but the K variant is relevant for the purpose of
this example).

Thanks.


--
DJ Dusty
------------------------------------------------------------------------
DJ Dusty's Profile:
http://www.excelforum.com/member.php...o&userid=16335
View this thread: http://www.excelforum.com/showthread...hreadid=524597