Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi there, I need to cycle through every row of data, look in column A and find i the string "Total" exists in the cell. the string will be part of another string. e.g. "D01234-A Total". Every instance that is found of a cell in column A containing Total eill require the entire row to be made 'Bold' font. does this sound do-able? -- matp ----------------------------------------------------------------------- matpj's Profile: http://www.excelforum.com/member.php...fo&userid=2107 View this thread: http://www.excelforum.com/showthread.php?threadid=51310 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi pal, This is the code to search through all your values in your cells; Code: -------------------- i = 1: Do If InStr(1, Cells(i, 1).Value, "Total", vbTextCompare) < 0 Then 'change cell colour code here End If i = i + 1 Loop Until Cells(i, 1).Value = "" -------------------- -- gti_jobert ------------------------------------------------------------------------ gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634 View this thread: http://www.excelforum.com/showthread...hreadid=513103 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() hi, thanks for the code! it works like a charm! I amended it to bold the entire row: (not sure how to make a code winod in this forum) i = 1: Do If InStr(1, Cells(i, 1).Value, "Total", vbTextCompare) < Then Cells(i, 1).EntireRow.Font.Bold = True End If i = i + 1 Loop Until Cells(i, 1).Value = "" out of interest, can you explain the parameters in the InStr function. I understand what the Cells(i,1).Value does, but the vbTextCompare i'v never come across, and the first '1' in the InStr... thanks very much, Mat -- matp ----------------------------------------------------------------------- matpj's Profile: http://www.excelforum.com/member.php...fo&userid=2107 View this thread: http://www.excelforum.com/showthread.php?threadid=51310 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello again, glad to hear it works fine - I only found out how to do it myself yesterday when i was building a search tool using the InStr function. http://www.techonthenet.com/excel/formulas/ This is a good site to have a look at, it explaing how alot of functions work inc the InStr one. -- gti_jobert ------------------------------------------------------------------------ gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634 View this thread: http://www.excelforum.com/showthread...hreadid=513103 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The 1 tells it to start looking at the first character.
vbTextCompare tells it to make a text comparison, which is not case sensitive. -- HTH Bob Phillips (remove nothere from the email address if mailing direct) "matpj" wrote in message ... hi, thanks for the code! it works like a charm! I amended it to bold the entire row: (not sure how to make a code winod in this forum) i = 1: Do If InStr(1, Cells(i, 1).Value, "Total", vbTextCompare) < 0 Then Cells(i, 1).EntireRow.Font.Bold = True End If i = i + 1 Loop Until Cells(i, 1).Value = "" out of interest, can you explain the parameters in the InStr function. I understand what the Cells(i,1).Value does, but the vbTextCompare i've never come across, and the first '1' in the InStr... thanks very much, Matt -- matpj ------------------------------------------------------------------------ matpj's Profile: http://www.excelforum.com/member.php...o&userid=21076 View this thread: http://www.excelforum.com/showthread...hreadid=513103 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
The easiest / fastest solution i would suggest is to use conditional formatting. Select the first row of data in your sheet and use the conditional format of... [Formula is ] =NOT(ISERROR(FIND("total",A2))) Where 'total' is the string you want to find and A2 is the cell to check your string for. Simply use the format painter to paint the conditional formats for the rest of the rows in your sheet and viola!!! note: when you paint the formats the cell reference will change to compliment where you paint the conditional format. You shouldn't need VB, unless am missing the point? -davemac matpj wrote: Hi there, I need to cycle through every row of data, look in column A and find if the string "Total" exists in the cell. the string will be part of another string. e.g. "D01234-A Total". Every instance that is found of a cell in column A containing Total, eill require the entire row to be made 'Bold' font. does this sound do-able?? -- matpj ------------------------------------------------------------------------ matpj's Profile: http://www.excelforum.com/member.php...o&userid=21076 View this thread: http://www.excelforum.com/showthread...hreadid=513103 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I make a graph with 2-cycle X 3-cycle log-log graph paper? | Charts and Charting in Excel | |||
How do I keep result from 1 iteration cycle to use in next cycle? | Excel Discussion (Misc queries) | |||
Change/cycle cell entry to next option from validation list (macro | Excel Programming | |||
How do I: Cycle through selections by clicking on cell | Excel Programming | |||
Create a formula into a String then assign string to a cell | Excel Programming |