Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Identifying rows in a message box

I have a procedure below which checks for occurences of a text value in a named range
"mynewset" as it occurs in another range. It then checks the values of particular cells
offset from any matching text and runs a counter to find the occurence of one cell having
a greater value than the other. It then finishes with a message box indicating the number
of occurences of this situation. This works perfectly and does all that is asked of it. I
know that I could highlight the rows where this occurs but what I would ideally like to
do is for the message box to list the row numbers where this occurs. ie instead of saying
"the set-aside is ineligible in m fields" I would like it to list where the rows are. I
really just do not know and cannot find how to do this, and would value any help

Regards
Graham Haughs
Turriff
Scotland

Sub Setaside()

Dim N As Long
Dim C As Variant
Dim Rng As Range
Dim FirstAddress As String
Dim m As Integer
Dim n As Integer
Dim Wng As Range

ActiveWorkbook.Names.Add Name:="mynewset", RefersToR1C1:= _
"=CSVEditor.xls!FULLSET"
Set Rng = Range("mynewset")
Set Wng = Range("h15:h400")
m = WorksheetFunction.CountIf(Wng, "*")

With Rng
n = 0
For N = 15 To m + 14
Set C = .Find(Cells(N, 14).Value, LookIn:=xlValues, LookAt:=xlWhole)
If Not C Is Nothing Then
FirstAddress = C.Address
Do
If (Cells(N, 14).Offset(0, 1).Value Cells(N, 14).Offset(0, -3)) Then
n = n + 1
End If
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address < FirstAddress
End If
Next
End With
If n 0 Then
MsgBox ("The set-aside is ineligible in " & m & " field"), , "Set-aside"
End If
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Identifying rows in a message box

Dim mesage as string
mesage=""

and then after the:

Set C = .FindNext(C)

insert something like:

mesage=mesage & C.row & Chr(10)

and near the end just MsgBox(mesage)
--
Gary''s Student - gsnu2007h


"Graham H" wrote:

I have a procedure below which checks for occurences of a text value in a named range
"mynewset" as it occurs in another range. It then checks the values of particular cells
offset from any matching text and runs a counter to find the occurence of one cell having
a greater value than the other. It then finishes with a message box indicating the number
of occurences of this situation. This works perfectly and does all that is asked of it. I
know that I could highlight the rows where this occurs but what I would ideally like to
do is for the message box to list the row numbers where this occurs. ie instead of saying
"the set-aside is ineligible in m fields" I would like it to list where the rows are. I
really just do not know and cannot find how to do this, and would value any help

Regards
Graham Haughs
Turriff
Scotland

Sub Setaside()

Dim N As Long
Dim C As Variant
Dim Rng As Range
Dim FirstAddress As String
Dim m As Integer
Dim n As Integer
Dim Wng As Range

ActiveWorkbook.Names.Add Name:="mynewset", RefersToR1C1:= _
"=CSVEditor.xls!FULLSET"
Set Rng = Range("mynewset")
Set Wng = Range("h15:h400")
m = WorksheetFunction.CountIf(Wng, "*")

With Rng
n = 0
For N = 15 To m + 14
Set C = .Find(Cells(N, 14).Value, LookIn:=xlValues, LookAt:=xlWhole)
If Not C Is Nothing Then
FirstAddress = C.Address
Do
If (Cells(N, 14).Offset(0, 1).Value Cells(N, 14).Offset(0, -3)) Then
n = n + 1
End If
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address < FirstAddress
End If
Next
End With
If n 0 Then
MsgBox ("The set-aside is ineligible in " & m & " field"), , "Set-aside"
End If
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Identifying rows in a message box

Many thanks for that and for coming back so quickly.

Graham

Gary''s Student wrote:
Dim mesage as string
mesage=""

and then after the:

Set C = .FindNext(C)

insert something like:

mesage=mesage & C.row & Chr(10)

and near the end just MsgBox(mesage)

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
tabs identifying columns and rows George Excel Discussion (Misc queries) 2 April 18th 10 04:06 AM
Identifying duplicate rows TBA Excel Discussion (Misc queries) 2 June 15th 07 09:38 AM
Identifying rows selected by filter Fred Davis Excel Programming 1 February 23rd 07 02:08 PM
Identifying Unique Rows Kestrel1492[_3_] Excel Programming 0 July 8th 05 05:56 PM
Identifying blank rows Raj[_8_] Excel Programming 5 February 25th 04 10:59 AM


All times are GMT +1. The time now is 11:57 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"