Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help on writing a code to copy and amend lines
I have a document which shows project spend and cost of work done.
The rates are split into weekday, weekday overtime, weekend and weeken overtime. Overtime is charged when one person works for over 7.5 hour each day on the same project. The data that is imported into the document only differentiates betwee weekday and weekend work. These show as rate 1 for weekday and rate 2 for weekend work. Can anyone help me with a code which would take the number of hour above 7.5 and put them into a new line which was then charged at th overtime rate? ie in the sample document attached line 18 shows as 8.5 hours worked o saturday at rate 2. I would like this to show 7.5 hours on saturday a rate 2 and then, on the line below, 1 hour at rate 4. line 25 shows 10 hours on Monday at rate 1 which should split into 7. hours at rate 1 and 2.5 hours at rate 3. I am quite experienced at formulas, but new to VBA and macros, so an help would be much appreciated. Thanks Attachment filename: charge document.xls Download attachment: http://www.excelforum.com/attachment.php?postid=43217 -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help on writing a code to copy and amend lines
Hi Karen
This is quite easy to achieve, and as most problems there are a couple of ways of doing this. The bellow code would be my favourate way of achieving this. (Please note in excel anything contained in "" will be assumed as a string) If reference to first cell 7.5 the reference to second cell = reference to first cell - 7. reference to first cell = 7. end i If you are new to VBA then the references will still be quite difficult. The best way is to define your worksheets like variables Dim varname1 as workshee Set varname1 = Workbook("Workbook.xls").worksheets("sheet1" You can then use the variable name you have used to reference the worksheet. calling cells is now very easy Varname1.range("A1").valu Simply change the range to whichever cell you wish. Welcome to the world of object oriented programming Hope this has been helpful Regards Russell |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help on writing a code to copy and amend lines
Thanks for your help and advice - I will give it a go
-- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
amend a VB code please | Excel Discussion (Misc queries) | |||
Amend the DV0022 - Update Validation Selections code for more lists | Excel Worksheet Functions | |||
Writing many lines on a same Excel 2000 cell | Excel Discussion (Misc queries) | |||
Amend code or change it completely? | Excel Programming | |||
Amend form code to allow an option | Excel Programming |