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 ***
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 ***
Please Login or Register to view this content.
---------------------------------------------------
ONLY APPLIES TO VBA RESPONSES WHERE APPROPRIATE
To insert code into the VBE (Visual Basic Editor)
- Copy the code.
- Open workbook to paste code into.
- Right click any worksheet tab, select View Code
- VBE (Visual Basic Editor) opens to that sheets object
- You may change to another sheets object or the This Workbook object by double clicking it in the Project window
- In the blank space below the word "General" paste the copied code.
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
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(xlCellTypeConstants,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(xlCellTypeFormulas,23)
HTH,
Bernie
MS Excel MVP
<Aria> wrote in message news:[email protected]...
> 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 ***
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 ***
Something like this???
Please Login or Register to view this content.
Yes, thank-you Excelenator! That's exactly what I needed.
Aria
*** Sent via Developersdex http://www.developersdex.com ***
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks