Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I skip a blank cell within macro?


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I skip a blank cell within macro?


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

--
mudrake
-----------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...nfo&userid=247
View this thread: http://www.excelforum.com/showthread.php?threadid=52459

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I skip a blank cell within macro?


Thanks mudraker, that's worked a treat. Great stuff, thanks again

--
DJ Dust
-----------------------------------------------------------------------
DJ Dusty's Profile: http://www.excelforum.com/member.php...fo&userid=1633
View this thread: http://www.excelforum.com/showthread.php?threadid=52459

  #4   Report Post  
Posted to microsoft.public.excel.programming
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



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
MACRO PASTE CELL to COLUMN, SKIP ROWS Dan Excel Discussion (Misc queries) 1 February 2nd 10 01:03 PM
Combine and display values in range in 1 cell but skip blank cells Swiss Excel Worksheet Functions 3 September 4th 09 10:00 PM
skip cell if blank go on to use another cell in calculation sosborne Excel Programming 0 March 8th 06 09:33 PM
Skip blank cells on transpose in a macro Melanie O Excel Programming 2 June 22nd 05 02:41 PM
how to skip the blank cells nayeemoddin Excel Discussion (Misc queries) 1 December 6th 04 07:07 AM


All times are GMT +1. The time now is 06:21 PM.

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"