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 / New Users / April 2008

Tip: Looking for answers? Try searching our database.

Determine if a linked cell contains data

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve Bentley - 24 Apr 2008 23:31 GMT
Using vba I'd like to change the formatting/colours on a particular cell
if the cell contains text.

So for example:

If Application.WorksheetFunction.IsText(Cells(i, ColNum)) Then
                Cells(i, ColNum).Font.Bold = True
                Cells(i, ColNum).Interior.ColorIndex = 40
End If

This works fine for cells which do contain text but not for cells which
contain 'linked text'. I have some cells which are linked from a 2nd
sheet and in the 2nd sheet they contain text.

The code above does not work because there the cell contains ='Sheet2'!B93

How can I get the results I'm needing?

Thanks
Steve
Ken Johnson - 25 Apr 2008 01:57 GMT
On Apr 25, 8:31 am, Steve Bentley <steveno.bentleyMAPSdel...@arcor.de>
wrote:
> Using vba I'd like to change the formatting/colours on a particular cell
> if the cell contains text.
[quoted text clipped - 16 lines]
> Thanks
> Steve

With my xl2003 your code works properly, ie linked text is recognised
as text and the formatting is applied.
What is returned by ISTEXT(Sheet2!B93) in any cell on the activesheet?

I did add...

Else: Cells(i, ColNum).Font.Bold = False
       Cells(i, ColNum).Interior.ColorIndex = 0

to the If statement so that the formatting for text would be removed
in the event of it already being present, but I doubt that that would
be the solution to your problem.

Ken Johnson
Bentley.Steve1@googlemail.com - 25 Apr 2008 17:07 GMT
> On Apr 25, 8:31 am, Steve Bentley <steveno.bentleyMAPSdel...@arcor.de>
> wrote:
[quoted text clipped - 34 lines]
>
> Ken Johnson

Hi,
Sorry I had some conditional formatting already enabled for these
cells. Once I removed this then the code also works fine.
Sorry for this.

Steve
Ken Johnson - 25 Apr 2008 17:24 GMT
On Apr 26, 2:07 am, Bentley.Ste...@googlemail.com wrote:

> > On Apr 25, 8:31 am, Steve Bentley <steveno.bentleyMAPSdel...@arcor.de>
> > wrote:
[quoted text clipped - 41 lines]
>
> Steve

Hi Steve,

The old forgotten Conditional Formatting trap!
I've fallen in that one myself.
Nice to know things are now OK.

Ken Johnson
 
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.