PDA

View Full Version : Update macro to add tan border as shown in worksheet example



keilah
05-27-2008, 12:50 AM
see attached workbook - book1.xls
Hi Experts

Need to amend the attached vba code so the modified verison adds a tan border as shown in worksheet "Cashflow Q4" (see Arrow)..... with borders to match.......

question also on EE: http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_23434002.html

see explain in workbook...

here is the code.........


Sub alaeod_5() 'Add Line At End Of Data
Dim lastrow As Long
Dim rng As Range
Dim startrow As Long
Dim strData As String

str1 = "B"
With Sheets("Cashflow Q4")
lastrow = .Cells(.Cells.Rows.Count, str1).End(xlUp).Row
strData = .Cells(lastrow, str1).Value
For startrow = lastrow - 1 To 1 Step -1
If .Cells(startrow, str1).Value <> strData Then
startrow = startrow + 1
Exit For
End If
Next
Set rng = Range(.Cells(startrow, str1), .Cells(lastrow, "BA"))
End With

With rng.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With rng.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With rng.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With

With Sheets("Cashflow Q4")
Set rng = Range(.Cells(startrow, str1), .Cells(lastrow, "F"))
With rng.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End With

With Sheet)(“Alloc (Sc.3)”)
Set

End Sub

Aussiebear
06-09-2008, 12:23 AM
Hi Keilah, Have you found a solution to this issue? If so can you post it?