I wonder if anyone can help me, I think part of the solution involves using active cell.
I import lots of data into a spreadsheet then have to manually format it which takes hours, I want code to automate it.
Example: I have data such as:
No-----Name-----Date---Price----Cost
10-----Dino------etc-----1--------2
10-----Dino------etc-----3-------5
12-----Bino------etc-----4--------6
13-----Rino------etc------5-------5
13-----Rino-----etc-------6--------6
I want it looking like this:
No-----Name-----Date---Price----Cost
10-----Dino------etc-----1--------2
10-----Dino------etc-----3-------5
shaded cells to here ishh 4-------7
No-----Name-----Date---Price----Cost
12-----Bino------etc-----4--------6
shaded cells to here ishh 4---------6
No-----Name-----Date---Price----Cost
13-----Rino------etc------5-------5
13-----Rino-----etc-------6--------6
shaded cells to here ishh 11-------11
The difficulty is due to the fact that the number in No column varies, for example there may be 2 rows of 10 or 4 rows of 10. What is the quickest way to format it all too, so have a border and font size etc all the same?
At present I have to manually insert blank rows between the different numbers in the No column, copy column headings, then manually sum up Price and Cost, then insert borders. But for hundreds of records.
Any ideas?
I found this code to insert 3 blank rows manually for me when the numbers in No column are different:
Sub Insert Rows
myRow = 3
Do Until Cells(myRow, 1) = ""
If Cells(myRow, 1) <> Cells(myRow - 1,1) Then
Rows(myRow).EntireRow.Insert
Rows(myRow).EntireRow.Insert
Rows(myRow).EntireRow.Insert
myRow=myRow + 3
End if
myRow=myRow + 1
Loop
End Sub
Thanks for any suggestions inc web sites or books, if this is possible in a macro or VBA.
Bookmarks