Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
border on last cell of page effects border on beginning cell of ne | Excel Discussion (Misc queries) | |||
How can I test a range of cells for the presence of a border? | Excel Worksheet Functions | |||
Apply bottom border only on filled cells, leaves blank cells without border? | Excel Programming | |||
Calculate mean of test scores from rows of test answers | Excel Discussion (Misc queries) | |||
Changing the border of one cell s/n change the border of adjacent | Excel Discussion (Misc queries) |