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: 6
Default Border looping macro

Howdee all.
Well, this is coming in from the Google Groups-
microsoft.public.excel.programming server-- any way to directly access
the newsgroups anymore? If so-- please explain how, or provide a
link.

Last year, I was talking with Dave Peterson about a macro to loop
based on the borders. Below is the code he'd provided. I now finally
have time to sit down and work through it.
The original post is @
http://groups.google.com/group/micro...be577f968cbcf8

The code is:

Dim Mycell, myRng As Range
Dim topcell, botcell As Range

Set myRng = Selection

For Each Mycell In myRng.Columns(1).Cells
If Mycell.Borders(xlEdgeTop).LineStyle = xlSolid Or
Mycell.Borders(xlEdgeTop).LineStyle = xlDouble Then
Set topcell = Mycell

Else
If Mycell.Borders(xlEdgeBottom).LineStyle = xlSolid Then
If topcell Is Nothing Then
MsgBox "Missing topcell for: " &
Mycell.Address(0, 0)
Else
Set botcell = Mycell
Application.DisplayAlerts = False
ActiveSheet.Range(topcell, botcell).Merge
Application.DisplayAlerts = True
End If
'get ready for next pair
Set topcell = Nothing
Set botcell = Nothing
End If
End If
Next Mycell

In my working through this, it appears to stop before it accomplishes
my goal. I.e., it finds the TopCell, and then exits the macro. I need
it to start working through each cell to find the BotCell, and then
perform the merge operation.
What am I missing here?
Thank you.
 
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
A toggling border macro Tom Excel Discussion (Misc queries) 10 May 26th 09 12:59 PM
Macro for a Border JSnow Excel Discussion (Misc queries) 2 September 3rd 08 07:51 PM
Macro to add border JSnow Excel Programming 2 September 3rd 08 07:33 PM
Place a Bottom Border in a Table via a Macro [email protected] Excel Discussion (Misc queries) 0 February 25th 07 11:19 PM
Changing the border of one cell s/n change the border of adjacent gjanssenmn Excel Discussion (Misc queries) 2 October 5th 05 08:35 PM


All times are GMT +1. The time now is 01:18 PM.

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"