Hi,
I've got a spreadsheet that people are using as a diary, the user will simply select a series of cells (in a column) and then click on a button to add an activity, each cell in a column represents half an hour.
The problem i've got is with the code i've created to reset the diary, basically people select an activity they have added and can remove it by clicking on a button and running this code.
The problem arises when the activity is only half an hour (1 cell) long. the code is breaking down on the xlInsideHorizontal properties line (obviously a single cell will not have any inside horizontal lines.....
Can anybody suggest an alternative? My code for the whole routine is as follows:
It's driving me nuts, was thinking of giving it a bit of logic to see if there is an inside horizontal line, but not sure if this would work or even how to code something like this...
Thanks for any help
Dr
I've got a spreadsheet that people are using as a diary, the user will simply select a series of cells (in a column) and then click on a button to add an activity, each cell in a column represents half an hour.
The problem i've got is with the code i've created to reset the diary, basically people select an activity they have added and can remove it by clicking on a button and running this code.
The problem arises when the activity is only half an hour (1 cell) long. the code is breaking down on the xlInsideHorizontal properties line (obviously a single cell will not have any inside horizontal lines.....
Can anybody suggest an alternative? My code for the whole routine is as follows:
Code:
Selection.ClearContents
With Selection
.MergeCells = False
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlDot
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlDot
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlDot
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlDot
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
[b]With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlDot
.Weight = xlThin
.ColorIndex = xlAutomatic
End With[/b]
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End Sub
It's driving me nuts, was thinking of giving it a bit of logic to see if there is an inside horizontal line, but not sure if this would work or even how to code something like this...
Thanks for any help
Dr