LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Text not looping through ranges

I have multiple ranges in various locations in the worksheet where I need to
merge cells in each range. The ranges are seperate and independant of each
other. Not merging into one big cell. Once the merge happens, a font is set
up and text is placed in each of the cells.

The problem is that all the ranges are merging, but the text is only placed
in the first range. I assume the problem is in how the code is telling where
to put the text.

Here is the code:


Sub Special_Terms_Booger()
Dim MyRange As Range, MyRange1 As Range, MyRange2 As Range
Set MyRange = Union(Range("M38:W42"), Range("M95:W99"))
Set MyRange1 = Union(Range("M152:W156"), Range("M209:W213"))
Set MyRange2 = Union(MyRange, MyRange1)
MyRange2.Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
With ActiveCell.Characters(Start:=1, Length:=245).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
End With
For Each cell In MyRange2
ActiveCell.FormulaR1C1 = _
"This is my text."
Next cell
End Sub
 
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
looping thru named ranges Greg Excel Programming 1 December 23rd 08 05:12 PM
Looping through ranges Tim Excel Programming 2 October 6th 08 10:03 AM
looping through an array of ranges Arnold Klapheck Excel Programming 1 September 28th 06 06:46 PM
Looping in VB with cell ranges Freeman Excel Worksheet Functions 2 January 22nd 06 12:14 PM
Looping through named ranges Tim[_38_] Excel Programming 1 May 10th 04 07:20 PM


All times are GMT +1. The time now is 08:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"