ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Range object (https://www.excelbanter.com/excel-programming/275524-re-copy-range-object.html)

Jan Karel Pieterse

Copy Range object
 
Hi,

Without copying (shape of range needs to be identical):

Worksheets("Sheet1").Range("A1:B2")=Worksheets
("Sheet2").Range("A1:B2")

Regards,

Jan Karel Pieterse
Excel TA/MVP

-----Original Message-----
Hi,

i'd like to copy one "x" row on worksheet1 to "y" row on

worksheet2 or range
1 on worksheet1 to range 2 on worksheet2. Could i copy

(assign) one range to
another without use copy or copy/pase metod?

Thanks

Milos


.


M.

Copy Range object
 
Hi Jan,
yesterday i wrote this sentence:
Worksheets("Sheet1").Range("9:9")=Worksheets("Shee t2").Range("15:15")
but on worksheet 1 was nothing hapened!

Regards,

Milos

"Jan Karel Pieterse" wrote in message
...
Hi,

Without copying (shape of range needs to be identical):

Worksheets("Sheet1").Range("A1:B2")=Worksheets
("Sheet2").Range("A1:B2")

Regards,

Jan Karel Pieterse
Excel TA/MVP

-----Original Message-----
Hi,

i'd like to copy one "x" row on worksheet1 to "y" row on

worksheet2 or range
1 on worksheet1 to range 2 on worksheet2. Could i copy

(assign) one range to
another without use copy or copy/pase metod?

Thanks

Milos


.




Tom Ogilvy

Copy Range object
 
I found the same in xl2000, but this worked

Worksheets("Sheet1").Range("9:9").Value= _
Worksheets("Sheet2").Range("15:15").Value

--
Regards,
Tom Ogilvy

"M." wrote in message
...
Hi Jan,
yesterday i wrote this sentence:
Worksheets("Sheet1").Range("9:9")=Worksheets("Shee t2").Range("15:15")
but on worksheet 1 was nothing hapened!

Regards,

Milos

"Jan Karel Pieterse" wrote in message
...
Hi,

Without copying (shape of range needs to be identical):

Worksheets("Sheet1").Range("A1:B2")=Worksheets
("Sheet2").Range("A1:B2")

Regards,

Jan Karel Pieterse
Excel TA/MVP

-----Original Message-----
Hi,

i'd like to copy one "x" row on worksheet1 to "y" row on

worksheet2 or range
1 on worksheet1 to range 2 on worksheet2. Could i copy

(assign) one range to
another without use copy or copy/pase metod?

Thanks

Milos


.






Tom Ogilvy

Copy Range object
 
You said you didn't want to do use copy or copy/paste - that is the easiest
way to copy formatting - what I showed just copyies values (even if the
source had formulas).

You would have to loop through your cells and specify what attributes you
wanted to transfer to do it without using the clipboard.
for each cell in Worksheets("Sheet2").Range("15:15")
With worksheets("Sheet1").Cells(9,cell.column)
.Font.Name = cell.font.name
.Font.Size = cell.Font.size
.Font.Bold = cell.font.bold
.Font.colorIndex = cell.font.ColorIndex
.Interior.colorIndex = cell.Interior.ColorIndex
.Formula = cell.Formula
' or .Value = cell.Value
' and so forth for whatever attributes you want copies
End With
Next

--
Regards,
Tom Ogilvy


"M." wrote in message
...
Hello Tom, i'm waiting for your explaination but ...
Worksheets("Sheet1").Range("9:9").Value= _
Worksheets("Sheet2").Range("15:15").Value
that's righ but in this manoeuvre you lost formating from first sheet!

Regards,

Milos

"Tom Ogilvy" wrote in message
...
I found the same in xl2000, but this worked

Worksheets("Sheet1").Range("9:9").Value= _
Worksheets("Sheet2").Range("15:15").Value

--
Regards,
Tom Ogilvy

"M." wrote in message
...
Hi Jan,
yesterday i wrote this sentence:
Worksheets("Sheet1").Range("9:9")=Worksheets("Shee t2").Range("15:15")
but on worksheet 1 was nothing hapened!

Regards,

Milos

"Jan Karel Pieterse" wrote in message
...
Hi,

Without copying (shape of range needs to be identical):

Worksheets("Sheet1").Range("A1:B2")=Worksheets
("Sheet2").Range("A1:B2")

Regards,

Jan Karel Pieterse
Excel TA/MVP

-----Original Message-----
Hi,

i'd like to copy one "x" row on worksheet1 to "y" row on
worksheet2 or range
1 on worksheet1 to range 2 on worksheet2. Could i copy
(assign) one range to
another without use copy or copy/pase metod?

Thanks

Milos


.










M.

Copy Range object
 
Tom, that's good.
In meantime i was used copy and destination O.K., that's work fine, ... and
i was adjusted code to work with this metod and propertis, but in the future
i would use your example of coping ranges.

Thank's!

Milos


"Tom Ogilvy" wrote in message
...
You said you didn't want to do use copy or copy/paste - that is the

easiest
way to copy formatting - what I showed just copyies values (even if the
source had formulas).

You would have to loop through your cells and specify what attributes you
wanted to transfer to do it without using the clipboard.
for each cell in Worksheets("Sheet2").Range("15:15")
With worksheets("Sheet1").Cells(9,cell.column)
.Font.Name = cell.font.name
.Font.Size = cell.Font.size
.Font.Bold = cell.font.bold
.Font.colorIndex = cell.font.ColorIndex
.Interior.colorIndex = cell.Interior.ColorIndex
.Formula = cell.Formula
' or .Value = cell.Value
' and so forth for whatever attributes you want copies
End With
Next

--
Regards,
Tom Ogilvy


"M." wrote in message
...
Hello Tom, i'm waiting for your explaination but ...
Worksheets("Sheet1").Range("9:9").Value= _
Worksheets("Sheet2").Range("15:15").Value
that's righ but in this manoeuvre you lost formating from first sheet!

Regards,

Milos

"Tom Ogilvy" wrote in message
...
I found the same in xl2000, but this worked

Worksheets("Sheet1").Range("9:9").Value= _
Worksheets("Sheet2").Range("15:15").Value

--
Regards,
Tom Ogilvy

"M." wrote in message
...
Hi Jan,
yesterday i wrote this sentence:

Worksheets("Sheet1").Range("9:9")=Worksheets("Shee t2").Range("15:15")
but on worksheet 1 was nothing hapened!

Regards,

Milos

"Jan Karel Pieterse" wrote in message
...
Hi,

Without copying (shape of range needs to be identical):

Worksheets("Sheet1").Range("A1:B2")=Worksheets
("Sheet2").Range("A1:B2")

Regards,

Jan Karel Pieterse
Excel TA/MVP

-----Original Message-----
Hi,

i'd like to copy one "x" row on worksheet1 to "y" row on
worksheet2 or range
1 on worksheet1 to range 2 on worksheet2. Could i copy
(assign) one range to
another without use copy or copy/pase metod?

Thanks

Milos


.













All times are GMT +1. The time now is 02:43 AM.

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