how to copy and paste a DATA from one sheet to another

charith

Board Regular
Joined
Jan 3, 2014
Messages
152
hello...

i want to copy column A,D,E,F from sheet 1 to sheet 2 column B,C,D,F...

I have a sheet titled "Main" that contains the raw data like the example below. I have another sheets titled "Orders" and . I'm needing a code to copy the data only from column A,D,E,F in "Main" sheet, and paste it in the "Sheet 2" column B,C,D,F based on "sell & buy" values

Sheet(main)
ABCDEF
ORDER TYPE#ORDERSPRICE%
BUY145.780.1
SELL232354.670.15
----
BUY34567890.23

<tbody>
</tbody>

Sheet(Orders)
ABCDFG
A1BUY145.780.1
B2SELL232354.670.15
C1BUY34567890.23
D1

<tbody>
</tbody>

Any help is MUCH appreciated THANK YOU!!
 
On the Main sheet, CY column (103), is blacked out and has no Header. Do you use it?

the "Open column(Column number 103)" fills with "Y"


And "current price" is column 49 not 48. "Open price is column 46 not 45.

So i want to copy "current price "(48) to " open price "(45) column when "open column (103)" = Y


Are you looking for code to do the copy?

Howard
 
Upvote 0

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
yeah, this is what i want..!
"current price "(48) to " open price "(45) column when "open column (103)" = Y
 
Upvote 0
On the Main sheet, CY column (103), is blacked out and has no Header. Do you use it?

the "Open column(Column number 103)" fills with "Y"


And "current price" is column 49 not 48. "Open price is column 46 not 45.

So i want to copy "current price "(48) to " open price "(45) column when "open column (103)" = Y


Are you looking for code to do the copy?

Howard

YEAH i want the code..
 
Upvote 0
You seem sure that this is what you want.

"current price "(48) to " open price "(45) column when "open column (103)" = Y


But when I look at the sheet Main from your link:

Column 48 is column AV and the Header for AV is "Gap" and the entries are % percentages.
Column 45 is column AS and the Header for AS "Short Drag" and the entries are % percentages.

Column 49 is column AW and the Header for AW is "Current Price" and the entries are $ dollars.
Column 46 is column AT and the Header for AT is "Open Price" and the entries are $ dollars.

So your statement above is in error.

And I have to ask again about column CY which is column 103. It is a narrow and blacked out column that looks like it is used as a border and there is no header "open". You don't really use a column that is blacked out for data entry do you?

What am I missing?

Howard
 
Upvote 0
i'm really sorry ..!!

it must be change to
current price "(49) to " open price "(46) column when "open column (104)" = Y

Thank you so much for your help..!!
 
Upvote 0
You seem sure that this is what you want.

"current price "(48) to " open price "(45) column when "open column (103)" = Y


But when I look at the sheet Main from your link:

Column 48 is column AV and the Header for AV is "Gap" and the entries are % percentages.
Column 45 is column AS and the Header for AS "Short Drag" and the entries are % percentages.

Column 49 is column AW and the Header for AW is "Current Price" and the entries are $ dollars.
Column 46 is column AT and the Header for AT is "Open Price" and the entries are $ dollars.

So your statement above is in error.

And I have to ask again about column CY which is column 103. It is a narrow and blacked out column that looks like it is used as a border and there is no header "open". You don't really use a column that is blacked out for data entry do you?

What am I missing?

Howard
https://www.dropbox.com/s/gp8s11lesiuahte/LIVE STOCK QUOTES (API) V5.1 test.xlsm

check this out ..
i'm really sorry ..!!


it must be change to
current price "(49) to " open price "(46) column when "open column (104)" = Y


Thank you so much for your help..!!
 
Upvote 0
This works on the workbook you posted.

I'm not sure what all the other stuff does in you change event macro.

I'll see if I can get it to operate on your change event.

What is the main change event on the sheet that you want the code to run on?

Howard

Code:
Option Explicit

Sub OneOFour()
Dim c As Range
Dim lr As Long
Dim cyOpen As Range

lr = Cells(Rows.Count, 104).End(xlUp).Row
Set cyOpen = Range("CY6:CY" & lr)

   For Each c In cyOpen
     If c = "Y" Then
       c.Offset(, -55).Copy c.Offset(, -58)
     End If
   Next

End Sub
 
Upvote 0
This works on the workbook you posted.

I'm not sure what all the other stuff does in you change event macro.

I'll see if I can get it to operate on your change event.

What is the main change event on the sheet that you want the code to run on?

Howard

Code:
Option Explicit

Sub OneOFour()
Dim c As Range
Dim lr As Long
Dim cyOpen As Range

lr = Cells(Rows.Count, 104).End(xlUp).Row
Set cyOpen = Range("CY6:CY" & lr)

   For Each c In cyOpen
     If c = "Y" Then
       c.Offset(, -55).Copy c.Offset(, -58)
     End If
   Next

End Sub

this code is working fine
but this is not the code i want, because it do not work when column CZ filling automatically with letter "Y"

1.enter a value to day high or day low..
1.png

2, then you can see letter "Y" will automatically generated in column "OPEN" (CZ)
2.png


In that case , i want to copy the current price(AW) to open price(AT)

please download this workbook and try it

https://www.dropbox.com/s/slw36wq6nly2cki/LIVE%20STOCK%20QUOTES%20%28API%29%20V5%20test.xlsm

Howard , Thank you very much for your great help..!!
 
Upvote 0

Forum statistics

Threads
1,214,621
Messages
6,120,568
Members
448,972
Latest member
Shantanu2024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top