ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combining two line of code (https://www.excelbanter.com/excel-programming/412206-combining-two-line-code.html)

Ardy

Combining two line of code
 
Hello All;
How would you combine this two line of code Excel-2007

Sheets(1).Range("B4").Copy
Sheets(3).Range("A3").PasteSpecial Paste:=xlPasteValues
Sheets(1).Range("B5").Copy
Sheets(3).Range("B3").PasteSpecial Paste:=xlPasteValues

I have tried

Sheets(1).Range("B4, B5").Copy
Sheets(3).Range("A3, B3").PasteSpecial Paste:=xlPasteValues
The first line is OK but the second gives me an error.

Ardy

Rick Rothstein \(MVP - VB\)[_2081_]

Combining two line of code
 
Try it this way...

Sheets(1).Range("B4:B5").Copy
Sheets(3).Range("A3").PasteSpecial Paste:=xlPasteValues, Transpose:=True

Rick


"Ardy" wrote in message
...
Hello All;
How would you combine this two line of code Excel-2007

Sheets(1).Range("B4").Copy
Sheets(3).Range("A3").PasteSpecial Paste:=xlPasteValues
Sheets(1).Range("B5").Copy
Sheets(3).Range("B3").PasteSpecial Paste:=xlPasteValues

I have tried

Sheets(1).Range("B4, B5").Copy
Sheets(3).Range("A3, B3").PasteSpecial Paste:=xlPasteValues
The first line is OK but the second gives me an error.

Ardy



Jim Thomlinson

Combining two line of code
 
Sheets(3).Range("A3").value = Sheets(1).Range("B4").value
Sheets(3).Range("B3").value = Sheets(1).Range("B5").value

or

Sheets(1).Range("B4, B5").Copy
Sheets(3).Range("A3").PasteSpecial Paste:=xlPasteValues, Transpose:=True

--
HTH...

Jim Thomlinson


"Ardy" wrote:

Hello All;
How would you combine this two line of code Excel-2007

Sheets(1).Range("B4").Copy
Sheets(3).Range("A3").PasteSpecial Paste:=xlPasteValues
Sheets(1).Range("B5").Copy
Sheets(3).Range("B3").PasteSpecial Paste:=xlPasteValues

I have tried

Sheets(1).Range("B4, B5").Copy
Sheets(3).Range("A3, B3").PasteSpecial Paste:=xlPasteValues
The first line is OK but the second gives me an error.

Ardy


Ardy

Combining two line of code
 
On Jun 6, 10:28*am, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote:
Sheets(3).Range("A3").value = Sheets(1).Range("B4").value
Sheets(3).Range("B3").value = Sheets(1).Range("B5").value

or

Sheets(1).Range("B4, B5").Copy
Sheets(3).Range("A3").PasteSpecial Paste:=xlPasteValues, Transpose:=True

--
HTH...

Jim Thomlinson



"Ardy" wrote:
Hello All;
How would you combine this two line of code Excel-2007


Sheets(1).Range("B4").Copy
Sheets(3).Range("A3").PasteSpecial Paste:=xlPasteValues
Sheets(1).Range("B5").Copy
Sheets(3).Range("B3").PasteSpecial Paste:=xlPasteValues


I have tried


Sheets(1).Range("B4, B5").Copy
Sheets(3).Range("A3, B3").PasteSpecial Paste:=xlPasteValues
The first line is OK but the second gives me an error.


Ardy- Hide quoted text -


- Show quoted text -


That is great, I love this news group.......I hope some body pays you
guys becuse it is well worthed.....

Can you explain the Transpose part dose this mean go to right insted
of down......

Jim Thomlinson

Combining two line of code
 
Transpose just turns rows into columns and vice versa... As for getting
paid... Just your never ending gratitude...
--
HTH...

Jim Thomlinson


"Ardy" wrote:

On Jun 6, 10:28 am, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote:
Sheets(3).Range("A3").value = Sheets(1).Range("B4").value
Sheets(3).Range("B3").value = Sheets(1).Range("B5").value

or

Sheets(1).Range("B4, B5").Copy
Sheets(3).Range("A3").PasteSpecial Paste:=xlPasteValues, Transpose:=True

--
HTH...

Jim Thomlinson



"Ardy" wrote:
Hello All;
How would you combine this two line of code Excel-2007


Sheets(1).Range("B4").Copy
Sheets(3).Range("A3").PasteSpecial Paste:=xlPasteValues
Sheets(1).Range("B5").Copy
Sheets(3).Range("B3").PasteSpecial Paste:=xlPasteValues


I have tried


Sheets(1).Range("B4, B5").Copy
Sheets(3).Range("A3, B3").PasteSpecial Paste:=xlPasteValues
The first line is OK but the second gives me an error.


Ardy- Hide quoted text -


- Show quoted text -


That is great, I love this news group.......I hope some body pays you
guys becuse it is well worthed.....

Can you explain the Transpose part dose this mean go to right insted
of down......



All times are GMT +1. The time now is 04:05 AM.

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