Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have some programming experience, but do not know VB.
I have spreadsheets for a league schedule that end up with several entries that are specifically "Bye". I need a macro to search for each occurrence of "Bye" and then replace it with "BYE" (upper case) but also with color red font. The sheets vary (not all the same size since some leagues run longer). Thanks for any help. See one of actual league schedule spreadsheets at my league web site: http://6amplayers.com/ click on matches on the left and then on "monday April 19, 2004" and then on the "Excel-file" link... |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Jim,
Try this For Each sh In ActiveWorkbook Set oCell = sh.Cells.Find("bye",Lookat:=xlWhole,MatchCase:=Tru e) If Not oCell Is Nothing Then Do oCell.Value = UCase(oCell.Value) oCell.Font.ColorIndex = 3 Set oCell = .FindNext(c) Loop While Not oCell Is Nothing End If Next sh -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Jim" wrote in message om... I have some programming experience, but do not know VB. I have spreadsheets for a league schedule that end up with several entries that are specifically "Bye". I need a macro to search for each occurrence of "Bye" and then replace it with "BYE" (upper case) but also with color red font. The sheets vary (not all the same size since some leagues run longer). Thanks for any help. See one of actual league schedule spreadsheets at my league web site: http://6amplayers.com/ click on matches on the left and then on "monday April 19, 2004" and then on the "Excel-file" link... |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Jim
For changing the case you can use EditReplace in the Menu Bar You can use the following example to change the color http://www.rondebruin.nl/find.htm Use the last macro on this page -- Regards Ron de Bruin http://www.rondebruin.nl "Jim" wrote in message om... I have some programming experience, but do not know VB. I have spreadsheets for a league schedule that end up with several entries that are specifically "Bye". I need a macro to search for each occurrence of "Bye" and then replace it with "BYE" (upper case) but also with color red font. The sheets vary (not all the same size since some leagues run longer). Thanks for any help. See one of actual league schedule spreadsheets at my league web site: http://6amplayers.com/ click on matches on the left and then on "monday April 19, 2004" and then on the "Excel-file" link... |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Bob, I get an error and debugger highlights .FindNext Error is: Invalid or unqualified reference... Thanks for a fix to this.... Jim *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
For Each sh In ActiveWorkbook
Set oCell = sh.Cells.Find("bye",Lookat:=xlWhole,MatchCase:=Tru e) If Not oCell Is Nothing Then Do oCell.Value = UCase(oCell.Value) oCell.Font.ColorIndex = 3 Set oCell = sh.Cells.FindNext(c) Loop While Not oCell Is Nothing End If Next sh -- Regards, Tom Ogilvy "Jim Mihalski" wrote in message ... Bob, I get an error and debugger highlights .FindNext Error is: Invalid or unqualified reference... Thanks for a fix to this.... Jim *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bob,
I get an error on execution: invalid or unqualified reference. this is highlighted by MVB: .FindNext swap ptd & speedi and at and remove spaces for direct email *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
As previously stated:
For Each sh In ActiveWorkbook Set oCell = sh.Cells.Find("bye",Lookat:=xlWhole,MatchCase:=Tru e) If Not oCell Is Nothing Then Do oCell.Value = UCase(oCell.Value) oCell.Font.ColorIndex = 3 Set oCell = sh.Cells.FindNext(c) Loop While Not oCell Is Nothing End If Next sh -- Regards, Tom Ogilvy "speedijim" <ptd at speedi.net wrote in message ... Bob, I get an error on execution: invalid or unqualified reference. this is highlighted by MVB: .FindNext swap ptd & speedi and at and remove spaces for direct email *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Use this
For Each sh In ActiveWorkbook.Sheets Set oCell = sh.Cells.Find("bye", Lookat:=xlWhole, MatchCase:=True) If Not oCell Is Nothing Then Do oCell.Value = UCase(oCell.Value) oCell.Font.ColorIndex = 3 Set oCell = sh.Cells.FindNext(oCell) Loop While Not oCell Is Nothing End If Next sh -- Regards Ron de Bruin http://www.rondebruin.nl "speedijim" <ptd at speedi.net wrote in message ... Bob, I get an error on execution: invalid or unqualified reference. this is highlighted by MVB: .FindNext swap ptd & speedi and at and remove spaces for direct email *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry Jim,
Didn't change one of the object references For Each sh In ActiveWorkbook Set oCell = sh.Cells.Find("bye",Lookat:=xlWhole,MatchCase:=Tru e) If Not oCell Is Nothing Then Do oCell.Value = UCase(oCell.Value) oCell.Font.ColorIndex = 3 Set oCell = .FindNext(oCell) Loop While Not oCell Is Nothing End If Next sh -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Jim Mihalski" wrote in message ... Bob, I get an error and debugger highlights .FindNext Error is: Invalid or unqualified reference... Thanks for a fix to this.... Jim *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
now I get this error:
"object doesn't support this object or method" I am doing a copy and paste of your code.... swap ptd & speedi and at and remove spaces *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ron,
Thanks so much.... That was the one that worked... I will take some time to try and determine why the otehrs didn't.. Thanks again!!!! swap ptd & speedi and at and remove spaces *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#12
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
They didn't work because I didn't correct both errors (didn't expect two
errors in the same line). Set oCell = sh.Cells.FindNext(c) was the correction but it should have been Set oCell = sh.Cells.FindNext(oCell) Ron caught them both. -- Regards, Tom Ogilvy "speedijim" <ptd at speedi.net wrote in message ... Ron, Thanks so much.... That was the one that worked... I will take some time to try and determine why the otehrs didn't.. Thanks again!!!! swap ptd & speedi and at and remove spaces *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#13
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Excel don't like this line also
For Each sh In ActiveWorkbook I change it to For Each sh In ActiveWorkbook.Sheets or you can use For Each sh In ActiveWorkbook.Worksheets -- Regards Ron de Bruin http://www.rondebruin.nl "Tom Ogilvy" wrote in message ... They didn't work because I didn't correct both errors (didn't expect two errors in the same line). Set oCell = sh.Cells.FindNext(c) was the correction but it should have been Set oCell = sh.Cells.FindNext(oCell) Ron caught them both. -- Regards, Tom Ogilvy "speedijim" <ptd at speedi.net wrote in message ... Ron, Thanks so much.... That was the one that worked... I will take some time to try and determine why the otehrs didn't.. Thanks again!!!! swap ptd & speedi and at and remove spaces *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
change data of entire column from small case to upper case | Excel Worksheet Functions | |||
How do I change from upper case to proper case in excel 2002 | Excel Discussion (Misc queries) | |||
Change the text from lower case to upper case in an Excel work boo | Excel Discussion (Misc queries) | |||
How do I change a column in Excel from upper case to lower case? | Excel Worksheet Functions | |||
How do I change existing text from lower case to upper case | Excel Discussion (Misc queries) |