Thread: Function
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Function

You also forgot that Cells should have the prepended dot...

.range(.cells(2,1),.cells(lr,lc)).copy _


In article ,
"Don Guillett" wrote:

I forgot a ). Should test.
.range(cells(2,1),cells(lr,lc)).copy
--
Don Guillett
SalesAid Software

"Don Guillett" wrote in message
...
Functions ( I assume you mean a UDF) return value as a regular function.
However, you code could be simplified and withOUT selections

with worksheets("Agents")
lr=.cells(rows.count,"a").end(xlup).row
'======
lc=.cells(columns.count,"b").end(xltoleft).column
'or
'lc=activecell.column
'========
.range(cells(2,1),cells(lr,lc).copy _
sheets("destinationsheet").range("a1")