Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have many rows of data and I would like to put some of that data into
a range (so I can chart that range) conditional on the contents of the cells. If the cells are a bunch of zeros, I do NOT want them to be included in the range. However if they have non-zero values in there, even if it is just one or two non-zero values in a row with mostly zeros, I'd like them to be in the range. Can anyone help? Travis |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can make a range with the UNION() function:
Sub gsnu() Dim r As Range Dim rNotEmpty As Range For Each r In Selection z = r.Value If z = 0 Then Else If rNotEmpty Is Nothing Then Set rNotEmpty = r Else Set rNotEmpty = Union(rNotEmpty, r) End If End If Next MsgBox (rNotEmpty.Address) End Sub Delete the msgbox once you are satisfied. -- Gary''s Student "travis" wrote: I have many rows of data and I would like to put some of that data into a range (so I can chart that range) conditional on the contents of the cells. If the cells are a bunch of zeros, I do NOT want them to be included in the range. However if they have non-zero values in there, even if it is just one or two non-zero values in a row with mostly zeros, I'd like them to be in the range. Can anyone help? Travis |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Defining Range using Cells | Excel Programming | |||
defining unique range of cells for different sheets as the same n. | Excel Discussion (Misc queries) | |||
Drop down defining content of a range of cells | Links and Linking in Excel | |||
Defining Range of For Each Loop for Cells and Worksheets | Excel Programming | |||
Defining a variable Range for cells with values in them! | Excel Programming |