Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selection of several records
Hi everybody, I have this code which works on selecting the filled records startin from the seventh row It is working properly, but the problem with it is that it selects al filled records even those which have zero value. So, I would like you please to edit it to select records that hav value greater than zero only. Code ------------------- Sub Select_Range() [A7:J7].Select Range(Selection, Selection.End(xlDown)).Select End Su ------------------- I hope that my question is clear for all, Thank you sooooooo mcuh -- LoveCandl ----------------------------------------------------------------------- LoveCandle's Profile: http://www.excelforum.com/member.php...fo&userid=2861 View this thread: http://www.excelforum.com/showthread.php?threadid=48715 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selection of several records
The value is in column A???
Then maybe something like this will give you an idea: Option Explicit Sub testme() Dim myRng As Range Dim iRow As Long Dim FirstRow As Long Dim LastRow As Long With ActiveSheet FirstRow = 7 LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For iRow = FirstRow To LastRow If .Cells(iRow, "A").Value 0 Then If myRng Is Nothing Then Set myRng = .Cells(iRow, "A") Else Set myRng = Union(.Cells(iRow, "A"), myRng) End If End If Next iRow If myRng Is Nothing Then MsgBox "Nothing to select!" Else '.select Intersect(myRng.EntireRow, .Range("a:j")).Select End If End With End Sub LoveCandle wrote: Hi everybody, I have this code which works on selecting the filled records starting from the seventh row It is working properly, but the problem with it is that it selects all filled records even those which have zero value. So, I would like you please to edit it to select records that have value greater than zero only. Code: -------------------- Sub Select_Range() [A7:J7].Select Range(Selection, Selection.End(xlDown)).Select End Sub -------------------- I hope that my question is clear for all, Thank you sooooooo mcuh, -- LoveCandle ------------------------------------------------------------------------ LoveCandle's Profile: http://www.excelforum.com/member.php...o&userid=28612 View this thread: http://www.excelforum.com/showthread...hreadid=487151 -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selection of several records
Thank you very much,, That is really what I am looking for -- LoveCandl ----------------------------------------------------------------------- LoveCandle's Profile: http://www.excelforum.com/member.php...fo&userid=2861 View this thread: http://www.excelforum.com/showthread.php?threadid=48715 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Limiting selection in a cell AND linking that selection to a list | Excel Discussion (Misc queries) | |||
Delete records when certain records have duplicate column data | New Users to Excel | |||
Copy Selection - Transpose Selection - Delete Selection | Excel Discussion (Misc queries) | |||
fraction of records matching filter selection not displayed in sta | Excel Discussion (Misc queries) | |||
# of Records Shown During Auto-Filter Selection | Excel Discussion (Misc queries) |