#1   Report Post  
Posted to microsoft.public.excel.misc
mariasa
 
Posts: n/a
Default find and highlight


Hi Guys,

could u please help me with the following macro:

i need it to go thru the column J of each of my worksheets (worksheet
names are 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999) and if it
finds "GR" as part of the name in the cell (say IFX GR - thats a
security id in bloomberg), it has to highlight the entire row ( i have
numerous columns in the sheet) and if it doesnt find "GR" it should do
nothing of course. I need this because i need to isolate (or highlight)
the german secondary offerings from the list of european ones.

Thanks so much in advance for your help!
mariasa


--
mariasa
------------------------------------------------------------------------
mariasa's Profile: http://www.excelforum.com/member.php...o&userid=31726
View this thread: http://www.excelforum.com/showthread...hreadid=557535

  #2   Report Post  
Posted to microsoft.public.excel.misc
Toppers
 
Posts: n/a
Default find and highlight

Try this:


Sub Find_GR()

Dim lastrow As Long
Dim wsname As String
Dim ws As Integer

For ws = 1999 To 2006
wsname = Trim(Str(ws))
Worksheets(wsname).Activate
With Worksheets(wsname)
lastrow = .Cells(Rows.Count, "J").End(xlUp).Row
With .Range("J1:J" & lastrow)
Set c = .Find("GR", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Rows(c.Row).Interior.ColorIndex = 3
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
End With
Next ws
End Sub


HTH
"mariasa" wrote:


Hi Guys,

could u please help me with the following macro:

i need it to go thru the column J of each of my worksheets (worksheet
names are 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999) and if it
finds "GR" as part of the name in the cell (say IFX GR - thats a
security id in bloomberg), it has to highlight the entire row ( i have
numerous columns in the sheet) and if it doesnt find "GR" it should do
nothing of course. I need this because i need to isolate (or highlight)
the german secondary offerings from the list of european ones.

Thanks so much in advance for your help!
mariasa


--
mariasa
------------------------------------------------------------------------
mariasa's Profile: http://www.excelforum.com/member.php...o&userid=31726
View this thread: http://www.excelforum.com/showthread...hreadid=557535


  #3   Report Post  
Posted to microsoft.public.excel.misc
mariasa
 
Posts: n/a
Default find and highlight


Thank you for ur response, Toppers. I tried it out and for some reason
it performed the sub only on ws 2006 and the rows it highlighted were
not exclusively the ones that had GR in column J as part of the string.
For example IPN FP Equity was the one picked up when looking for GR.
Strange..Do you have an idea of what could have gone wrong?

Thanks

Maria


--
mariasa
------------------------------------------------------------------------
mariasa's Profile: http://www.excelforum.com/member.php...o&userid=31726
View this thread: http://www.excelforum.com/showthread...hreadid=557535

  #4   Report Post  
Posted to microsoft.public.excel.misc
mariasa
 
Posts: n/a
Default find and highlight


JLatham, thanks a lot for ur suggestion but however when i tried it,
nothing changed in the workbook. No idea why that would be the
case...Any further advice?

Thanks,
Maria


--
mariasa
------------------------------------------------------------------------
mariasa's Profile: http://www.excelforum.com/member.php...o&userid=31726
View this thread: http://www.excelforum.com/showthread...hreadid=557535

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default find and highlight

Maria

I tried it with IFN FP Equity in Column J and it was NOT selected; I see no
possible reason for it selectin "IFN FP Equity". When I changed it to "IFN FP
Equity GR" then it was changed!

In my workbook I had worksheets 1999 and 2000 as a test and BOTH were changed.

So I don't have a clue as to why yours is not working.

Did you simply cut & paste the code?



"mariasa" wrote:


Thank you for ur response, Toppers. I tried it out and for some reason
it performed the sub only on ws 2006 and the rows it highlighted were
not exclusively the ones that had GR in column J as part of the string.
For example IPN FP Equity was the one picked up when looking for GR.
Strange..Do you have an idea of what could have gone wrong?

Thanks

Maria


--
mariasa
------------------------------------------------------------------------
mariasa's Profile: http://www.excelforum.com/member.php...o&userid=31726
View this thread: http://www.excelforum.com/showthread...hreadid=557535




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default find and highlight

If you want, post w/b to toppers<atjohntopley.fsnet.co.uk and I will have a
look at it.

"Toppers" wrote:

Maria

I tried it with IFN FP Equity in Column J and it was NOT selected; I see no
possible reason for it selectin "IFN FP Equity". When I changed it to "IFN FP
Equity GR" then it was changed!

In my workbook I had worksheets 1999 and 2000 as a test and BOTH were changed.

So I don't have a clue as to why yours is not working.

Did you simply cut & paste the code?



"mariasa" wrote:


Thank you for ur response, Toppers. I tried it out and for some reason
it performed the sub only on ws 2006 and the rows it highlighted were
not exclusively the ones that had GR in column J as part of the string.
For example IPN FP Equity was the one picked up when looking for GR.
Strange..Do you have an idea of what could have gone wrong?

Thanks

Maria


--
mariasa
------------------------------------------------------------------------
mariasa's Profile: http://www.excelforum.com/member.php...o&userid=31726
View this thread: http://www.excelforum.com/showthread...hreadid=557535


  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default find and highlight


Toppers,

my bad, i think the issue was in the ordering of the worksheets. it was
2006 to 1999 and i did it 1999 to 2006 this time and it worked
perfectly, so yea, thanks a lot for ur code, i seem to be all set now
:)

Kind Regards,
Maria


--
mariasa
------------------------------------------------------------------------
mariasa's Profile: http://www.excelforum.com/member.php...o&userid=31726
View this thread: http://www.excelforum.com/showthread...hreadid=557535

  #8   Report Post  
Posted to microsoft.public.excel.misc
JLatham
 
Posts: n/a
Default find and highlight

Another method - doesn't care what your sheet names are, examines all in the
workbook (which may not be what you want)

Sub HighlightGREntries()

Dim AnySheet As Worksheet
Dim ThisSheetName As String
Dim CurrentSelection As String

ThisSheetName = ActiveSheet.Name
CurrentSelection = ActiveCell.Address

Application.ScreenUpdating = False
For Each AnySheet In ThisWorkbook.Worksheets
Worksheets(AnySheet.Name).Activate
Range("G65535").End(xlUp).Select
ActiveCell.Offset(1, 0).Activate
Do While ActiveCell.Row 1
ActiveCell.Offset(-1, 0).Activate
If InStr(ActiveCell, "GR") Then
With Selection.EntireRow
.Interior.ColorIndex = 34 ' teal
'other color codes
'Red = 3
'Blue = 5
'pale yellow = 36
'bright yellow = 6
End With
Else
With Selection.EntireRow
.Interior.ColorIndex = xlNone
End With
End If
Loop
Next ' AnySheet Worksheet loop
'back to where we started
Worksheets(ThisSheetName).Activate
Range(CurrentSelection).Select
Application.ScreenUpdating = True
End Sub

"mariasa" wrote:


Hi Guys,

could u please help me with the following macro:

i need it to go thru the column J of each of my worksheets (worksheet
names are 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999) and if it
finds "GR" as part of the name in the cell (say IFX GR - thats a
security id in bloomberg), it has to highlight the entire row ( i have
numerous columns in the sheet) and if it doesnt find "GR" it should do
nothing of course. I need this because i need to isolate (or highlight)
the german secondary offerings from the list of european ones.

Thanks so much in advance for your help!
mariasa


--
mariasa
------------------------------------------------------------------------
mariasa's Profile: http://www.excelforum.com/member.php...o&userid=31726
View this thread: http://www.excelforum.com/showthread...hreadid=557535


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
match multiple criteria and highlight corresponding row in Excel D Assess Excel Worksheet Functions 1 March 2nd 06 04:22 PM
Highlight FIND Results Yonaga Excel Discussion (Misc queries) 4 February 10th 06 04:56 PM
How to highlight cells... Mare Excel Discussion (Misc queries) 3 January 28th 06 01:09 PM
Why code for find() is not working jesmin Excel Discussion (Misc queries) 1 December 28th 05 08:43 PM
VBA, excel - find, resize and sort Danny Excel Worksheet Functions 3 August 9th 05 04:10 AM


All times are GMT +1. The time now is 06:18 AM.

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

About Us

"It's about Microsoft Excel"