Rows

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

I am creating an excel workbook to use in estimating costs in my building
business. I want to get the workbook to automatically add a row if I have
entered data in the previous row. Does any one know how to do this. If so can
you give me idiot proof instructions of how to do so? Thank you in advance...
Mark P
 
I assume you have a total row with formulas. You probably want to always
have one blank row between the total row and the last line of data. Use a
worksheet change function and search for total in column A. then check if
the row below the word total is blank like this

Private Sub Worksheet_Change(ByVal Target As Range)
set c = columns("A").find(what:="Total", lookin:=xlvalues,lookat:=xlwhole)
if not c is nothing then
if c.offset(-1,0) <> "" then
rows(c.row).insert
end if
end if

end Sub
 
Back
Top