Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default use border for IF test

Ok, apparently my previous post was too involved so let's try this.

I want to perform a task using an IF test.
The most common element in the workbook that I can think of to test for is
the existence of a border around a group of cells.

So far, my tests seem to not be fully working, and I can't see why.

Sub borderloopA()
Dim rcell, rcell1, rcell2 As Range
Dim lx As Integer

Set rcell = Selection
Set rcell1 = Selection
Set rcell2 = Selection
'Application.DisplayAlerts = False

For Each rcell In Selection
Do
For Each rcell1 In Selection
Do
'if borderTOP = true then
If rcell1.Borders(xlEdgeTop).LineStyle = xlSolid Then 'Or
xlDouble
ActiveCell.Offset(1, 0).Select
'rcell.Select
'if border-TOP/BOTTOM = false then
If ActiveCell.Borders(xlEdgeTop).LineStyle < xlSolid Then
ActiveCell.Offset(1, 0).Select
'rcell1.Select
'if border-TOP/BOTTOM = false then
If ActiveCell.Borders(xlEdgeTop).LineStyle <
xlSolid Then
ActiveCell.Offset(1, 0).Select
'rcell1.Select
'if borderBottom = true then
For Each rcell2 In Selection
If
rcell2.Borders(xlEdgeBottom).LineStyle = xlSolid Then
ActiveSheet.Range(rcell1,
rcell2).Select
With Selection
.Merge
.VerticalAlignment = xlCenter
.HorizontalAlignment =
xlCenter
End With
Set rcell1 = Nothing
Set rcell2 = Nothing
'end if
End If
Next rcell2
'end if
End If
'end if
End If
'end if
End If
lx = lx + 1
Loop Until lx = 2
Next rcell1
Loop Until ActiveCell.Style.IncludeBorder = False
Next rcell

'Application.DisplayAlerts = True


End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default scratch request

ok, scratch this, the border test works fine, it's something else that's not
working-- will use a new post.

"Steve" wrote:

Ok, apparently my previous post was too involved so let's try this.

I want to perform a task using an IF test.
The most common element in the workbook that I can think of to test for is
the existence of a border around a group of cells.

So far, my tests seem to not be fully working, and I can't see why.

Sub borderloopA()
Dim rcell, rcell1, rcell2 As Range
Dim lx As Integer

Set rcell = Selection
Set rcell1 = Selection
Set rcell2 = Selection
'Application.DisplayAlerts = False

For Each rcell In Selection
Do
For Each rcell1 In Selection
Do
'if borderTOP = true then
If rcell1.Borders(xlEdgeTop).LineStyle = xlSolid Then 'Or
xlDouble
ActiveCell.Offset(1, 0).Select
'rcell.Select
'if border-TOP/BOTTOM = false then
If ActiveCell.Borders(xlEdgeTop).LineStyle < xlSolid Then
ActiveCell.Offset(1, 0).Select
'rcell1.Select
'if border-TOP/BOTTOM = false then
If ActiveCell.Borders(xlEdgeTop).LineStyle <
xlSolid Then
ActiveCell.Offset(1, 0).Select
'rcell1.Select
'if borderBottom = true then
For Each rcell2 In Selection
If
rcell2.Borders(xlEdgeBottom).LineStyle = xlSolid Then
ActiveSheet.Range(rcell1,
rcell2).Select
With Selection
.Merge
.VerticalAlignment = xlCenter
.HorizontalAlignment =
xlCenter
End With
Set rcell1 = Nothing
Set rcell2 = Nothing
'end if
End If
Next rcell2
'end if
End If
'end if
End If
'end if
End If
lx = lx + 1
Loop Until lx = 2
Next rcell1
Loop Until ActiveCell.Style.IncludeBorder = False
Next rcell

'Application.DisplayAlerts = True


End Sub


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
border on last cell of page effects border on beginning cell of ne GaryE Excel Discussion (Misc queries) 0 March 23rd 09 05:47 AM
How can I test a range of cells for the presence of a border? PFB Excel Worksheet Functions 7 November 10th 08 05:19 AM
Apply bottom border only on filled cells, leaves blank cells without border? StargateFan[_3_] Excel Programming 4 April 8th 07 05:39 PM
Calculate mean of test scores from rows of test answers RiotLoadTime Excel Discussion (Misc queries) 1 July 26th 06 05:14 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:40 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"