Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

How do I skip a blank cell within macro?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DJ Dusty - 20 Mar 2006 23:42 GMT
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.

Signature

DJ Dusty

mudraker - 21 Mar 2006 00:04 GMT
IF Range("A" & F)="" then
K = K + 1
else
ActiveCell.FormulaR1C1 = "=IF(RC[-3]="""",0,IF(RC[1]="""",1,0))"
K = K + 1
end i
DJ Dusty - 21 Mar 2006 00:13 GMT
Thanks mudraker, that's worked a treat. Great stuff, thanks again
Trevor Shuttleworth - 21 Mar 2006 00:17 GMT
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

> I have the following for...next loop:
>
[quoted text clipped - 19 lines]
>
> Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.