ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   range: question (https://www.excelbanter.com/excel-programming/292261-range-question.html)

Simon Sunke

range: question
 
hi

why doesn't that piece of code work:
table1.range("B19","C19") = table1.range("A2","B2")
or
table1.range("B19:C19") = table1.range("A2:B2")

both do not work. I want to copy the content from table5 at A2:B2 to table1
at B19:C19

when I only select one cell, like this: range("A2"), it works great.

thanks for your help
Simon



Bob Phillips[_6_]

range: question
 
Simon,

Try this

Range("B19:C19").Value = Range("A2:B2").Value

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Simon Sunke" wrote in message
...
hi

why doesn't that piece of code work:
table1.range("B19","C19") = table1.range("A2","B2")
or
table1.range("B19:C19") = table1.range("A2:B2")

both do not work. I want to copy the content from table5 at A2:B2 to

table1
at B19:C19

when I only select one cell, like this: range("A2"), it works great.

thanks for your help
Simon





No Name

range: question
 
I didn't test your code to figure out why it doesn't work,
but here's some code that will work (adjust accordingly):
-------- Begin Code --------
Dim rng As Range

Set rng = ActiveSheet.Range("A2:B2")
rng.Copy ThisWorkbook.Worksheets("Sheet2").Range("B19:C19")
Set rng = Nothing
-------- End Code --------

This code assumes that the worksheet with the A2:B2 range
is the active one at the time of its execution.




All times are GMT +1. The time now is 09:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com