ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB Add a blank row? (https://www.excelbanter.com/excel-programming/385983-vbulletin-add-blank-row.html)

Sandy

VB Add a blank row?
 
Is there an easy way to add a blank row after each sub-total in a spreadsheet
using VB?

Thanks,

Sandy

Tom Ogilvy

VB Add a blank row?
 
assume the word Total in is column F

Sub Addrows()
Dim lastrow as Long, i as Long
lastrow = cells(rows.count,"F").end(xlup).row
for i = lastrow to 2 step -1
if instr(1,cells(i,"F"),"Total",vbTextCompare) then
rows(i).Insert
end if
Next
End sub


--
Regards,
Tom Ogilvy

"Sandy" wrote:

Is there an easy way to add a blank row after each sub-total in a spreadsheet
using VB?

Thanks,

Sandy



All times are GMT +1. The time now is 08:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com