Afternoon,
I'm sure this is simple, but I can't get my head round it.
I have a workbook that aggregates 3 separate worksheets onto a 'summary' sheet then sorts it into weekday order.
I'm sure this is not the most efficient coding ever, but it does work.
What I am trying to then do is to add a thick border round Each section (day of the week.
My sheet is as follows:
<tbody>
</tbody>
So with the example above I would like it to have a thick border around A2:I3, A4:I6, A7:I7, A8:I8.
Because the info is dynamic I wont know where these are only that the Day of the week will be in column 1 and that they will always be sorted into weekday order.
I hope this all makes sense and is probably easier than I have explained it. But, I am always grateful for any assistance i can get.
Thank you in advance
I'm sure this is simple, but I can't get my head round it.
I have a workbook that aggregates 3 separate worksheets onto a 'summary' sheet then sorts it into weekday order.
Code:
Private Sub Worksheet_Activate()
Application.ScreenUpdating = False
Range("A9:G4000").Select
Range("A9:G4000").Clear
Selection.ClearFormats
' CDVP
Dim nextrow As Long
nextrow = Cells(4000, 1).End(xlUp).Row + 1
If nextrow < 2 Then nextrow = 2
If nextrow > 4000 Then
MsgBox ("The next empty row is outside the range, IdioT!"), vbExclamation
Exit Sub
End If
Dim rng
Set rng = Worksheets("CDVP").UsedRange
Intersect(rng, rng.Offset(1)).Copy
Range("A" & nextrow).Select
ActiveSheet.Paste
' TSP
nextrow = Cells(4000, 1).End(xlUp).Row + 1
If nextrow < 2 Then nextrow = 2
If nextrow > 4000 Then
MsgBox ("The next empty row is outside the range, IdioT!"), vbExclamation
Exit Sub
End If
Set rng = Worksheets("TSP").UsedRange
Intersect(rng, rng.Offset(1)).Copy
Range("A" & nextrow).Select
ActiveSheet.Paste
' SOGP
nextrow = Cells(4000, 1).End(xlUp).Row + 1
If nextrow < 2 Then nextrow = 2
If nextrow > 4000 Then
MsgBox ("The next empty row is outside the range, IdioT!"), vbExclamation
Exit Sub
End If
Set rng = Worksheets("SOGP").UsedRange
Intersect(rng, rng.Offset(1)).Copy
Range("A" & nextrow).Select
ActiveSheet.Paste
Cells.Select
Selection.RowHeight = 25
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Key2:=Range("B2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=3, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _
:=xlSortNormal
Columns("D:D").Select
Selection.Style = "Currency"
Dim myrange As Range
Dim icounter As Long
Set myrange = ActiveSheet.UsedRange
For icounter = myrange.Rows.Count To 1 Step -1
If Application.CountA(Rows(icounter).EntireRow) = 0 Then
Rows(icounter).Delete
End If
Next icounter
Application.ScreenUpdating = True
End Sub
I'm sure this is not the most efficient coding ever, but it does work.
What I am trying to then do is to add a thick border round Each section (day of the week.
My sheet is as follows:
A | B | C | D | E | F | G | H | I | |
1 | Weekday | Group | Stuff | Stuff | Stuff | Stuff | Stuff | Stuff | Stuff |
2 | Monday | TSP | |||||||
3 | Monday | SGP | |||||||
4 | Tuesday | TSP | |||||||
5 | Tuesday | TSP | |||||||
6 | Tuesday | SGP | |||||||
7 | Wednesday | BPR | |||||||
8 | Thursday | SMR |
<tbody>
</tbody>
So with the example above I would like it to have a thick border around A2:I3, A4:I6, A7:I7, A8:I8.
Because the info is dynamic I wont know where these are only that the Day of the week will be in column 1 and that they will always be sorted into weekday order.
I hope this all makes sense and is probably easier than I have explained it. But, I am always grateful for any assistance i can get.
Thank you in advance