Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dk dk is offline
external usenet poster
 
Posts: 129
Default determine if wrap text is set within a range

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 163
Default determine if wrap text is set within a range

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"
  #3   Report Post  
Posted to microsoft.public.excel.programming
dk dk is offline
external usenet poster
 
Posts: 129
Default determine if wrap text is set within a range

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"

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 163
Default determine if wrap text is set within a range

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"






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default determine if wrap text is set within a range

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
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
How do I get date/time to wrap (format - wrap text doesn't work)? Alex Excel Discussion (Misc queries) 3 April 4th 23 02:29 PM
Excel 2007; even though "Wrap Text" is on the text does wrap? Bruce M[_2_] Excel Discussion (Misc queries) 0 December 31st 09 02:58 PM
Wrap text doesn't wrap [email protected] Excel Worksheet Functions 1 March 28th 07 01:58 AM
Determine the text in a range that covers several cells [email protected] Excel Programming 10 August 10th 06 04:06 PM
Combobox to determine text for a range of cells Robbyn Excel Programming 0 June 26th 06 03:18 PM


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