View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Russell Lucas Russell Lucas is offline
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