Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
amend a VB code please Morgan Excel Discussion (Misc queries) 0 March 3rd 10 11:17 PM
Amend the DV0022 - Update Validation Selections code for more lists [email protected] Excel Worksheet Functions 1 January 4th 09 01:19 PM
Writing many lines on a same Excel 2000 cell freeposte Excel Discussion (Misc queries) 2 December 8th 04 02:45 PM
Amend code or change it completely? Gareth[_3_] Excel Programming 2 December 1st 03 07:24 PM
Amend form code to allow an option Stuart[_5_] Excel Programming 3 October 23rd 03 08:11 PM


All times are GMT +1. The time now is 02:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"