Populating a Range by Code

  • Thread starter Thread starter Nigel Bennett
  • Start date Start date
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:o50") = Sheets
("plan").Range("d4:o4")

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

Can someone help me with the correct syntax

Thanks
 
Hi Nigel

Only add .value and it is working

Sub test()
Sheets("Book vs Plan").Range("d50:o50").Value = _
Sheets("plan").Range("d4:o4").Value
End Sub
 
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:o50") = Sheets
| ("plan").Range("d4:o4")
|
| but that failed, no error messages but no data either.
|
| Can someone help me with the correct syntax
|
| Thanks
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top