Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Trying to concatenate based on font color

I have imported a csv file that splits the names into 3 different colomns. I
am trying to merge the names back together but only when it meets certain
criteria. Cannot figure out how to make the following formula work only on
cells that have a font ColorIndex of 3. Have searched but can't find quite
the right answer. Thanks in advance for your help.

Sub ConcatColor()
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lastrow '<<assumes header row
Range("P" & i) = Cells(i, 7) & " " & Cells(i, 8) & " " & Cells(i, 9)
Next
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Trying to concatenate based on font color

Need value.
Range("P" & i) = Cells(i, 7).Value & " " & Cells(i, 8).Value & " " &
Cells(i, 9).Value



"jeremiah" wrote:

I have imported a csv file that splits the names into 3 different colomns. I
am trying to merge the names back together but only when it meets certain
criteria. Cannot figure out how to make the following formula work only on
cells that have a font ColorIndex of 3. Have searched but can't find quite
the right answer. Thanks in advance for your help.

Sub ConcatColor()
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lastrow '<<assumes header row
Range("P" & i) = Cells(i, 7) & " " & Cells(i, 8) & " " & Cells(i, 9)
Next
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Trying to concatenate based on font color

Hi,

I'm not sure which cells you want to check the colorindex of but this may
get you going in the right direction

For i = 2 To lastrow '<<assumes header row
If Range("P" & i).Interior.ColorIndex = 3 Then
Range("P" & i) = Cells(i, 7) & " " & Cells(i, 8) & " " & Cells(i, 9)
Next


Mike
"jeremiah" wrote:

I have imported a csv file that splits the names into 3 different colomns. I
am trying to merge the names back together but only when it meets certain
criteria. Cannot figure out how to make the following formula work only on
cells that have a font ColorIndex of 3. Have searched but can't find quite
the right answer. Thanks in advance for your help.

Sub ConcatColor()
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lastrow '<<assumes header row
Range("P" & i) = Cells(i, 7) & " " & Cells(i, 8) & " " & Cells(i, 9)
Next
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Trying to concatenate based on font color

Thanks so much, I knew it was a very simple fix. I did have a compile error
but inserted an End If and works perfectly.

"Mike H" wrote:

Hi,

I'm not sure which cells you want to check the colorindex of but this may
get you going in the right direction

For i = 2 To lastrow '<<assumes header row
If Range("P" & i).Interior.ColorIndex = 3 Then
Range("P" & i) = Cells(i, 7) & " " & Cells(i, 8) & " " & Cells(i, 9)
Next


Mike
"jeremiah" wrote:

I have imported a csv file that splits the names into 3 different colomns. I
am trying to merge the names back together but only when it meets certain
criteria. Cannot figure out how to make the following formula work only on
cells that have a font ColorIndex of 3. Have searched but can't find quite
the right answer. Thanks in advance for your help.

Sub ConcatColor()
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lastrow '<<assumes header row
Range("P" & i) = Cells(i, 7) & " " & Cells(i, 8) & " " & Cells(i, 9)
Next
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Trying to concatenate based on font color

Hi,

Thanks for the feedback. I never tested it so missed the missing End If.

Mike

"jeremiah" wrote:

Thanks so much, I knew it was a very simple fix. I did have a compile error
but inserted an End If and works perfectly.

"Mike H" wrote:

Hi,

I'm not sure which cells you want to check the colorindex of but this may
get you going in the right direction

For i = 2 To lastrow '<<assumes header row
If Range("P" & i).Interior.ColorIndex = 3 Then
Range("P" & i) = Cells(i, 7) & " " & Cells(i, 8) & " " & Cells(i, 9)
Next


Mike
"jeremiah" wrote:

I have imported a csv file that splits the names into 3 different colomns. I
am trying to merge the names back together but only when it meets certain
criteria. Cannot figure out how to make the following formula work only on
cells that have a font ColorIndex of 3. Have searched but can't find quite
the right answer. Thanks in advance for your help.

Sub ConcatColor()
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lastrow '<<assumes header row
Range("P" & i) = Cells(i, 7) & " " & Cells(i, 8) & " " & Cells(i, 9)
Next
End Sub

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
Changing Font color based on font type or size John Excel Discussion (Misc queries) 2 February 7th 08 12:50 AM
change font color based on a value Golf Nut[_2_] Excel Worksheet Functions 1 April 26th 07 03:30 PM
How do I concatenate text to keep the text's original color/font/s Temp_User Excel Discussion (Misc queries) 1 September 12th 05 10:12 PM
Sum based on font color mario Excel Programming 2 April 19th 05 07:58 AM
Portion of concatenate formula to have different color and font fo Colleen B Excel Worksheet Functions 1 February 23rd 05 03:32 PM


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