ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   VBA Inser a new Row (https://www.excelbanter.com/excel-discussion-misc-queries/65235-vba-inser-new-row.html)

Joel

VBA Inser a new Row
 
Hi Everyone,

Can anyone help me with this query in Excel 2003?

Background

I have a spreadsheet that keeps track of employee holidays, for example in
column €œA€ I have list of Employee names in column €œD€ I have the number of
holidays that that person is entitled to, Column €œE€ the number of Holidays
taken which is subtracted from €œD€ and then a few other bits and pieces .

Column €œN€ I have the a date Sun 01/04/2006 that then follows on for 6
months to Sat 30/09/2006

And the underneath that column I have the exact setup with the send half of
then year continue from the upper row.

I Have a couple of employees in already an to account for holidays an sick I
use countif statements each employee as there own row with in both parts of
the year one on top and on below for the second half of the year.

Example countif below For employee 1

=COUNTIF(N10:GM10,"s/2")/2+(COUNTIF(N31:GM31,"s/2")/2)+COUNTIF(N10:GM10,"s")+(COUNTIF(N31:GM31,"s"))

Example for Employee 2

=COUNTIF(N11:GM11,"s/2")/2+(COUNTIF(N32:GM32,"s/2")/2)+COUNTIF(N11:GM11,"s")+(COUNTIF(N32:GM32,"s"))

Question

Based on the above information

If I had ten Employees how would I write the VBA to insert a new row at
underneath the last one with €œName€ as there name and follow the same countif
statement above but for that person

So for example it would be

=COUNTIF(N12:GM12,"s/2")/2+(COUNTIF(N33:GM33,"s/2")/2)+COUNTIF(N12:GM12,"s")+(COUNTIF(N33:GM33,"s"))

And this would continue ever time a pressed €œNew Person it would insert a
line for them with there correct countif statements

Can it be done with Code on a command button if so can you please help

--
N/A


All times are GMT +1. The time now is 04:45 AM.

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