ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Comments (https://www.excelbanter.com/excel-programming/385443-comments.html)

Alex St-Pierre

Comments
 
Hi Tom!
b. I Check that if it is a range, it is on the same sheet as A1:H400 - if
not, attempting an intersect will lead to an error. (Peter T also tested for
this)

I posted the speed test in PeterT post. 0.18 seconds refer to your program
speed. I had an error with Gary's (#1004) and Charles program. As you said,
it is probably related to point b.
For point a. and c. I don't had problem related with these points. By
modifying your program as PeterT, it takes 0.14 seconds. I posted the code
below.
Thanks!
Alex

Sub RemoveWrapText()
Dim time1, time2
time1 = Timer

Dim nm As Name, rng As Range
Dim rng1 As Range, rng2 As Range
For Each nm In ThisWorkbook.Names
Set rng = Nothing
On Error Resume Next
Set rng = Evaluate(nm.Name)
On Error GoTo 0
If Not rng Is Nothing Then
If rng.Parent.Name = ActiveSheet.Name Then
Set rng1 = Intersect(rng, Range("A1:H400"))
If Not rng1 Is Nothing Then
If rng1.WrapText = True Then
rng1.WrapText = False
End If
Set rng1 = Nothing
End If
End If
End If
Next

time2 = Timer
MsgBox (time2 - time1)
End Sub

--
Alex St-Pierre


All times are GMT +1. The time now is 11:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com