Populating a Range by Code

N

Nigel Bennett

When a user selects an item from a list box I would like
it to go and select a range of from a sheet and
insert it in to another sheet, I tried doing this

Sheets("Book vs Plan").Range("d50:eek:50") = Sheets
("plan").Range("d4:eek:4")

but that failed, no error messages but no data either.

Can someone help me with the correct syntax

Thanks
 
R

Ron de Bruin

Hi Nigel

Only add .value and it is working

Sub test()
Sheets("Book vs Plan").Range("d50:eek:50").Value = _
Sheets("plan").Range("d4:eek:4").Value
End Sub
 
J

Jim Rech

Further to Ron...

The default property of the range object is .Value and so Excel almost
always uses it when it's omitted as you have done. But not always. Fwiw, I
never assume the default will work; I always specify what I want (.Value in
this case.)

--
Jim Rech
Excel MVP

| When a user selects an item from a list box I would like
| it to go and select a range of from a sheet and
| insert it in to another sheet, I tried doing this
|
| Sheets("Book vs Plan").Range("d50:eek:50") = Sheets
| ("plan").Range("d4:eek:4")
|
| but that failed, no error messages but no data either.
|
| Can someone help me with the correct syntax
|
| Thanks
|
 
Top