Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2008

Tip: Looking for answers? Try searching our database.

cell is merged and contains "something"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Carrie_Loos - 17 Jan 2008 23:20 GMT
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
Per Jessen - 17 Jan 2008 23:37 GMT
> 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
Carrie_Loos - 18 Jan 2008 19:51 GMT
I am still having the same issue - any other ideas?

>> 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 - 16 lines]
>
>Per
Carrie_Loos - 18 Jan 2008 20:42 GMT
My mistake, works well. Thanks

>> 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 - 16 lines]
>
>Per
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.