Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default For each....that is not blank

Hello,
How do you change this line to become For Each c in the range of B2 to
B12 that is Not Blank?

For Each c In Sheets("Inventory").Range("B2:B12")

:) Aria

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default For each....that is not blank


Code:
--------------------
For Each c In Sheets("Inventory").Range("B2:B12")
If c.value < "" Then
-your code here-
End if
Next c

--------------------


--
Excelenator


------------------------------------------------------------------------
Excelenator's Profile: http://www.excelforum.com/member.php...o&userid=36768
View this thread: http://www.excelforum.com/showthread...hreadid=572257

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default For each....that is not blank

How about just ignore the blanks, but still loop through them:

for each c in sheets("inventory").range("B2:B12").cells
if c.value = "" then
'do nothing, skip it
else
'do the real work here
end if
next c


Aria wrote:

Hello,
How do you change this line to become For Each c in the range of B2 to
B12 that is Not Blank?

For Each c In Sheets("Inventory").Range("B2:B12")

:) Aria

*** Sent via Developersdex http://www.developersdex.com ***


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default For each....that is not blank

If you know that they are constants (but not "" - those aren't actually blank), you could use:
For Each c In Sheets("Inventory").Range("B2:B12").SpecialCells(x lCellTypeConstants,23)

Or if they are all formulas (but not formulas that return "" - those also aren't actually blank):
For Each c In Sheets("Inventory").Range("B2:B12").SpecialCells(x lCellTypeFormulas,23)

HTH,
Bernie
MS Excel MVP


<Aria wrote in message ...
Hello,
How do you change this line to become For Each c in the range of B2 to
B12 that is Not Blank?

For Each c In Sheets("Inventory").Range("B2:B12")

:) Aria

*** Sent via Developersdex http://www.developersdex.com ***



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default For each....that is not blank

Thanks Excelenator, that's exactly what I needed. Thanks to Dave also.
How do you set another condition that for each d in C2 to C12 that
matches to $A$1, then afterwards trigger this code?

For Each c In Sheets("Inventory").Range("B2:B12")
If c.value < "" Then
-your code here-
End if
Next c

:) Aria


*** Sent via Developersdex http://www.developersdex.com ***


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default For each....that is not blank


Something like this???



Code:
--------------------
For Each d in Sheets("Inventory").Range("C2:C12")
IF d.value = Range("A1").Value Then
For Each c In Sheets("Inventory").Range("B2:B12")
If c.value < "" Then
-your code here-
End if
Next c
Next d
--------------------


--
Excelenator


------------------------------------------------------------------------
Excelenator's Profile: http://www.excelforum.com/member.php...o&userid=36768
View this thread: http://www.excelforum.com/showthread...hreadid=572257

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default For each....that is not blank

Yes, thank-you Excelenator! That's exactly what I needed.
:) Aria



*** Sent via Developersdex http://www.developersdex.com ***
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
Index/match - make blank cells return a blank value. diaare Excel Worksheet Functions 3 May 3rd 23 03:44 AM
Excel 2002: Return blank when VLOOKUP on blank cells Mr. Low Excel Discussion (Misc queries) 2 June 4th 09 05:12 PM
Average Formula to display blank cell if named range is blank Rachael F Excel Worksheet Functions 3 February 22nd 08 05:05 PM
Macro code to test for blank row and insert blank row if false Mattie Excel Programming 2 March 29th 06 01:19 AM
Copying and pasting a worksheet to a blank and removing blank rows Bob Reynolds[_3_] Excel Programming 0 June 24th 04 02:55 PM


All times are GMT +1. The time now is 11:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"