![]() |
Changing certain text within a cell
I make a production schedule on a daily basis and it has anywhere from 60-120 SKU's per day. I am running into the problem of having too many SKU's that are similar to eachother within one cell. This makes it hard for me to double check my schedule without looking very closely at each letter. A1 would contain this TBLUE(50) THMBLU(60) THBLU(10) THMBLU(47) Is there a formula I could use to color the prefix "THM" blue? I could then make the prefix "TH" a different color etc etc.. I want to avoid doing this manually as it would be quite time consuming for 120 SKU's. -- Brad1982 ------------------------------------------------------------------------ Brad1982's Profile: http://www.excelforum.com/member.php...o&userid=15690 View this thread: http://www.excelforum.com/showthread...hreadid=526815 |
Changing certain text within a cell
This is very easy if you use VBA:
Sub only_blue() Dim L As Long For L = 1 To 100 If Left(Cells(L, 1).Value, 3) = "THM" Then Cells(L, 1).Characters(Start:=1, Length:=3).Font.ColorIndex = 5 End If Next L End Sub This little program runs down the first 100 cells in column A and, if they start with THM, will make the THM blue. You can adjust the limits to suit your needs. -- Gary's Student "Brad1982" wrote: I make a production schedule on a daily basis and it has anywhere from 60-120 SKU's per day. I am running into the problem of having too many SKU's that are similar to eachother within one cell. This makes it hard for me to double check my schedule without looking very closely at each letter. A1 would contain this TBLUE(50) THMBLU(60) THBLU(10) THMBLU(47) Is there a formula I could use to color the prefix "THM" blue? I could then make the prefix "TH" a different color etc etc.. I want to avoid doing this manually as it would be quite time consuming for 120 SKU's. -- Brad1982 ------------------------------------------------------------------------ Brad1982's Profile: http://www.excelforum.com/member.php...o&userid=15690 View this thread: http://www.excelforum.com/showthread...hreadid=526815 |
Changing certain text within a cell
That only works if there is a single string in the cell:
A1 = THMBLU(20) A1 would contain this TBLUE(50) THMBLU(60) THBLU(10) THMBLU(47) Biff "Gary''s Student" wrote in message ... This is very easy if you use VBA: Sub only_blue() Dim L As Long For L = 1 To 100 If Left(Cells(L, 1).Value, 3) = "THM" Then Cells(L, 1).Characters(Start:=1, Length:=3).Font.ColorIndex = 5 End If Next L End Sub This little program runs down the first 100 cells in column A and, if they start with THM, will make the THM blue. You can adjust the limits to suit your needs. -- Gary's Student "Brad1982" wrote: I make a production schedule on a daily basis and it has anywhere from 60-120 SKU's per day. I am running into the problem of having too many SKU's that are similar to eachother within one cell. This makes it hard for me to double check my schedule without looking very closely at each letter. A1 would contain this TBLUE(50) THMBLU(60) THBLU(10) THMBLU(47) Is there a formula I could use to color the prefix "THM" blue? I could then make the prefix "TH" a different color etc etc.. I want to avoid doing this manually as it would be quite time consuming for 120 SKU's. -- Brad1982 ------------------------------------------------------------------------ Brad1982's Profile: http://www.excelforum.com/member.php...o&userid=15690 View this thread: http://www.excelforum.com/showthread...hreadid=526815 |
Changing certain text within a cell
You are correct Biff:
If ther are multiple strings within A1 containing THM, then the code would update only the leading instance. In that case: 1. copy the material to a Word doc. 2. use find/replace in Word to change THM into THM (blue) 3. copy the material back into Excel -- Gary's Student "Biff" wrote: That only works if there is a single string in the cell: A1 = THMBLU(20) A1 would contain this TBLUE(50) THMBLU(60) THBLU(10) THMBLU(47) Biff "Gary''s Student" wrote in message ... This is very easy if you use VBA: Sub only_blue() Dim L As Long For L = 1 To 100 If Left(Cells(L, 1).Value, 3) = "THM" Then Cells(L, 1).Characters(Start:=1, Length:=3).Font.ColorIndex = 5 End If Next L End Sub This little program runs down the first 100 cells in column A and, if they start with THM, will make the THM blue. You can adjust the limits to suit your needs. -- Gary's Student "Brad1982" wrote: I make a production schedule on a daily basis and it has anywhere from 60-120 SKU's per day. I am running into the problem of having too many SKU's that are similar to eachother within one cell. This makes it hard for me to double check my schedule without looking very closely at each letter. A1 would contain this TBLUE(50) THMBLU(60) THBLU(10) THMBLU(47) Is there a formula I could use to color the prefix "THM" blue? I could then make the prefix "TH" a different color etc etc.. I want to avoid doing this manually as it would be quite time consuming for 120 SKU's. -- Brad1982 ------------------------------------------------------------------------ Brad1982's Profile: http://www.excelforum.com/member.php...o&userid=15690 View this thread: http://www.excelforum.com/showthread...hreadid=526815 |
All times are GMT +1. The time now is 08:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com