cmschmitz24
Board Regular
- Joined
- Jan 27, 2017
- Messages
- 150
I'm trying to insert a blank row (with some formatting) after each new item in column B.
In the new row I want to have it highlighted in a grey color in cells A-J, "Total" in column I, and sum all of column J for all items in column B in column J.
I'm working with this code:
It would look something like this:
Thank you
Christina
In the new row I want to have it highlighted in a grey color in cells A-J, "Total" in column I, and sum all of column J for all items in column B in column J.
I'm working with this code:
Code:
my_ranger = Range("A1").CurrentRegion.Address
row_counter = Range(my_ranger).Rows.Count
'ADD MORE ROWS IF NEEDED BELOW
number_of_rows_to_insert = 4
final_row_count = row_counter + 1
x = 4
initial_to_check = Range("E3").Value
Do While x < final_row_count
this_rows_value = Range("E" & x).Value
If this_rows_value = initial_to_check Then
x = x + 1
Else
For y = 1 To number_of_rows_to_insert
Rows(x & ":" & x).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range(x & ":" & x).Clear
Next y
x = x + 1 + number_of_rows_to_insert
final_row_count = final_row_count + number_of_rows_to_insert
End If
initial_to_check = this_rows_value
Loop
It would look something like this:
Thank you
Christina