View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_2_] Patrick Molloy[_2_] is offline
external usenet poster
 
Posts: 1,298
Default referring to a named range on another worksheet

to copy a range from one sheet to another. Assuming rng is a range object

set rng = worksheets("sheet1").Range("b2:m15")

With rng


Worksheets("Sheet2").Range("A1").Resize(.Rows.Coun t,.Columns.Count).Value _
= .Value

End With





"Virginia" wrote:

i am getting an error message in my code when trying to refer to a named
range in a different worksheet (not the active sheet). i have a variable
"Rng" that refers to a non-contiguous named range on sheet1. a macro on a
form control is attempting to copy this range and paste it to sheet2. do i
always have to refer to the sheet name with a named range? i.e.
sheets("Sheet1").Range("MyRange")