Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default cell is merged and contains "something"

I am having trouble with this piece of code. I can't seem to make these two
variable work together. If I remove the "And Like "*me*" portion of the If
statement then the code will change the color correctly in the merged cells
but I can't seem to get the 'And' piece to work. Can anyone help?

Sub Customer_Colors()

For Each c In Range("B8:IT500")

If c.MergeCells = True And c.MergeCells Like "*something*" Then
c.Interior.ColorIndex = 4

Next

End Sub

Thanks
Carrie

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200801/1

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default cell is merged and contains "something"

On 18 Jan., 00:20, "Carrie_Loos via OfficeKB.com" <u34134@uwe wrote:
I am having trouble with this piece of code. I can't seem to make these two
variable work together. If I remove the "And Like "*me*" portion of the If
statement then the code will change the color correctly in the merged cells
but I can't seem to get the 'And' piece to work. Can anyone help?

Sub Customer_Colors()

For Each c In Range("B8:IT500")

If c.MergeCells = True And c.MergeCells Like "*something*" Then
* * c.Interior.ColorIndex = 4

Next

End Sub

Thanks
Carrie

--
Message posted via OfficeKB.comhttp://www.officekb.com/Uwe/Forums.aspx/excel-programming/200801/1


Hi Carrie

Try this

Sub Customer_Colors()
For Each c In Range("B7:IT50")
If c.MergeCells = True And c.Value Like "*something*" Then
c.Interior.ColorIndex = 4
Next
End Sub

Regards,

Per
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default cell is merged and contains "something"

I am still having the same issue - any other ideas?

Per Jessen wrote:
I am having trouble with this piece of code. I can't seem to make these two
variable work together. If I remove the "And Like "*me*" portion of the If

[quoted text clipped - 17 lines]
--
Message posted via OfficeKB.comhttp://www.officekb.com/Uwe/Forums.aspx/excel-programming/200801/1


Hi Carrie

Try this

Sub Customer_Colors()
For Each c In Range("B7:IT50")
If c.MergeCells = True And c.Value Like "*something*" Then
c.Interior.ColorIndex = 4
Next
End Sub

Regards,

Per


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200801/1

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default cell is merged and contains "something"

My mistake, works well. Thanks

Per Jessen wrote:
I am having trouble with this piece of code. I can't seem to make these two
variable work together. If I remove the "And Like "*me*" portion of the If

[quoted text clipped - 17 lines]
--
Message posted via OfficeKB.comhttp://www.officekb.com/Uwe/Forums.aspx/excel-programming/200801/1


Hi Carrie

Try this

Sub Customer_Colors()
For Each c In Range("B7:IT50")
If c.MergeCells = True And c.Value Like "*something*" Then
c.Interior.ColorIndex = 4
Next
End Sub

Regards,

Per


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200801/1

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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
How to find non-blank cell values "hidden" under merged regions? david.karr Excel Discussion (Misc queries) 7 April 7th 07 11:35 PM
"Cannot change part of a merged cell" when AutoFilter is turned on [email protected] Excel Programming 0 March 14th 07 05:31 PM
"Cannot Change Part of a Merged Cell" When updating link using mac Madhava Excel Programming 1 October 25th 05 10:14 AM
Convert "merged" cells to "CenterAcrossSelection" stone Excel Programming 2 February 2nd 04 06:23 PM


All times are GMT +1. The time now is 10:58 AM.

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"