View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Fill function to next cells

Is this better

Sub test()

LastCol = Cells(10, Columns.Count).End(xlToLeft).Column
Set copyrange = Range(Cells(10, LastCol - 1), Cells(20, LastCol - 1))
copyrange.Copy
copyrange.Offset(0, 1).Insert Shift:=xlToRight

End Sub


"carl" wrote:

Hi Joel,

Thanks for the help but the column that I need to fill isn't actually the
last column. It's the second last. So the macro is already set up to insert
a new column in between the last two columns and then I need to fill it with
the same functions as the one to the left.

Thanks

Carl

"Joel" wrote:

Carl: I think this is what you need

Sub test()

LastCol = Cells(10, Columns.Count).End(xlToLeft).Column
Set copyrange = Range(Cells(10, LastCol), Cells(20, LastCol))
copyrange.Copy Destination:=copyrange.Offset(0, 1)

End Sub