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!!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Okay, got the latest version and I notice that the bracket you show in your post is [...] and the bracket in column AW is an accounting bracket to show a negative value.

In my tests this works, but it is looking for a [.
(Module 2 code for left bracket [ in col AW)

Code:
For Each c In Arng
  For Each c In Brng
  
  If c.Offset(, -3) = "" Then
    If Left(c, 1) <> "[" Then
      c.Offset(, -3) = c
    End If
  End If
  
Next


I think you need this instead.
Test it and see if it works for you.
(Module 2 code or negative value in col Aw)

Code:
For Each c In Arng
  For Each c In Brng
  
  If c.Offset(, -3) = "" Then
    If c > 0 Then
      c.Offset(, -3) = c
    End If
  End If
  
Next

Howard
 
Last edited:
Upvote 0
that is great sir..

but i want to update the open price column once current price value changed from (1.00) to another value , then copy that value to "open price" column like this

Open priceCurrent Price
123.56123.56
-1[1.00]
1245.781245.78
789.45789.45

<tbody>
</tbody>
Open priceCurrent Price
123.56123.56
345.69345.69
1245.781245.78
789.45789.45

<tbody>
</tbody>

can you please hep me to do that sir...

Thank you very much
 
Upvote 0
Try this in sheet the Main code module.

Howard

Code:
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)

If Intersect(Target, Range("AW:AW,BI48:BJ65")) Is Nothing _
   Or Target.count > 1 Then Exit Sub
    
Dim rngAW As Range
Dim LRow As Long
Dim c As Range

LRow = Cells(Rows.count, 49).End(xlUp).Row
Set rngAW = Range("AW6:AW" & LRow)

Select Case Target.Column
   Case 49

      For Each c In rngAW
         If c.Offset(, -3) = "" Then
            If c > 0 Then
               c.Offset(, -3) = c
            End If
         End If
      Next
    
   Case 61, 62
      Cells(Target.Row, 46) = Cells(Target.Row, 49)
End Select

End Sub
 
Upvote 0
sir if i want to check the column 61 > 0 or column 62 > 0 when coping data from current price to open price ( Cells(Target.Row, 46) = Cells(Target.Row, 49)) what are the changes that i have to do in that code

Thank you very much
 
Upvote 0
Plug this in the code and see if it works for you.

You say you want to check if cells 61 and 62 are > 0. I assume if cells 61 or 62 are less than 0 then you do not want 46 to = 49.

This seems to do that in my tests.

Code:
Case 61, 62
     If Cells(Target.Row, 61) < 0 Then Exit Sub
     If Cells(Target.Row, 62) < 0 Then Exit Sub
        Cells(Target.Row, 46) = Cells(Target.Row, 49)

Howard
 
Last edited:
Upvote 0
Plug this in the code and see if it works for you.

You say you want to check if cells 61 and 62 are > 0. I assume if cells 61 or 62 are less than 0 then you do not want 46 to = 49.

This seems to do that in my tests.

Code:
Case 61, 62
     If Cells(Target.Row, 61) < 0 Then Exit Sub
     If Cells(Target.Row, 62) < 0 Then Exit Sub
        Cells(Target.Row, 46) = Cells(Target.Row, 49)

Howard
Thank you very much sir..
but it is not working... i tried like this also

Code:
Case 61, 62
     If Cells(Target.Row, 61)  = "" Then Exit Sub
     If Cells(Target.Row, 62)  = "" Then Exit Sub
        Cells(Target.Row, 46) = Cells(Target.Row, 49)

but it also didn't work ...!!

actually i want to cancel coping from column 49 ti column 46 when there is no data in column 61 and column 62

column 46(open price)column 49(current price)column 61(day high)column 62(day low)
123.56123.56756897
457.78457.78890345
1233--
56856890234

<tbody>
</tbody>

Thank you very much
 
Upvote 0

Forum statistics

Threads
1,216,038
Messages
6,128,447
Members
449,453
Latest member
jayeshw

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