PC Review


Reply
Thread Tools Rate Thread

determine if wrap text is set within a range

 
 
=?Utf-8?B?ZGs=?=
Guest
Posts: n/a
 
      29th Oct 2006
is it possible to determine if a cell or multiple cells within a range
have the wrap text property set to true? And then to get the addresses
of those cells?

tia,
dk
 
Reply With Quote
 
 
 
 
Helmut Weber
Guest
Posts: n/a
 
      29th Oct 2006
Hi dk

like this:

Dim oCll As Range
For Each oCll In Selection.Cells
If oCll.WrapText = True Then
MsgBox oCll.Address
End If
Next

--
Greetings from Bavaria, Germany

I'm not an Excel-expert.
Just exploring strange territory.

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
Reply With Quote
 
=?Utf-8?B?ZGs=?=
Guest
Posts: n/a
 
      29th Oct 2006
Thanks

So it appears that Looping through the range is the only way?


"Helmut Weber" wrote:

> Hi dk
>
> like this:
>
> Dim oCll As Range
> For Each oCll In Selection.Cells
> If oCll.WrapText = True Then
> MsgBox oCll.Address
> End If
> Next
>
> --
> Greetings from Bavaria, Germany
>
> I'm not an Excel-expert.
> Just exploring strange territory.
>
> Helmut Weber, MVP WordVBA
>
> Win XP, Office 2003
> "red.sys" & Chr$(64) & "t-online.de"
>

 
Reply With Quote
 
Helmut Weber
Guest
Posts: n/a
 
      29th Oct 2006
Hi,

on MsgBox Selection.Cells.WrapText

error 94 occurs,

if not all cells have the same wrap property,
which could speed up checking.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"






 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      29th Oct 2006
Depends on how much info you need.

If you select a range and look at format|cells|alignment tab, you'll see that
the wraptext is either:

clear (none has that setting)
checked (green check) (all have that setting)
or light check (green block) (some do, some don't).

You can check for the same thing in code:

Option Explicit
Sub testme01()
Dim myWT As Variant
Dim myRng As Range
Dim myCell As Range
Dim wks As Worksheet

Set wks = Worksheets("sheet1")

With wks
Set myRng = .Range("a1:c10")
End With

myWT = myRng.WrapText

If myWT = True Then
'all cells have that setting
MsgBox myRng.Address(0, 0) & " are all set for wrap text"
ElseIf myWT = False Then
'no cells have that setting
MsgBox myRng.Address(0, 0) & " is not set for wrap text"
Else
'mywt = null
For Each myCell In myRng.Cells
If myCell.WrapText = True Then
MsgBox myCell.Address(0, 0) & " is set for wrap text"
End If
Next myCell
End If

End Sub


dk wrote:
>
> Thanks
>
> So it appears that Looping through the range is the only way?
>
> "Helmut Weber" wrote:
>
> > Hi dk
> >
> > like this:
> >
> > Dim oCll As Range
> > For Each oCll In Selection.Cells
> > If oCll.WrapText = True Then
> > MsgBox oCll.Address
> > End If
> > Next
> >
> > --
> > Greetings from Bavaria, Germany
> >
> > I'm not an Excel-expert.
> > Just exploring strange territory.
> >
> > Helmut Weber, MVP WordVBA
> >
> > Win XP, Office 2003
> > "red.sys" & Chr$(64) & "t-online.de"
> >


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Determine if a range has text Regis Microsoft Excel Discussion 7 31st Oct 2007 11:38 PM
Determine the colour of text in each cell in a range of cells Khurram Microsoft Excel Programming 7 5th Feb 2007 02:46 PM
Determine the text in a range that covers several cells brotherescott@yahoo.com Microsoft Excel Programming 10 10th Aug 2006 04:06 PM
Combobox to determine text for a range of cells =?Utf-8?B?Um9iYnlu?= Microsoft Excel Programming 0 26th Jun 2006 03:18 PM
How do I wrap text within a range? =?Utf-8?B?amltMjUyNjI3?= Microsoft Frontpage 3 14th Nov 2004 02:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:53 PM.