Copy value in one sheet to another sheet

tvmex_210

New Member
Joined
Jan 19, 2011
Messages
11
Hello experts,
a newbie hre...

I have a workbook with 2 worksheets namely 'SHEET1' and 'SHEET2'. i have formulas in cells A10,B10 and C10 in SHEET1. The inputs for these formulas vary. Now, i want store the values in these cells to columns A,B and C of SHEET2 respectively, everytime the formula results in a new value. ie, when i input the first set of data , the values in A10,B10 &C10 should be copied to A1,B1 & C1 of SHEET2, then with next set of datas values should be copied to A2,B2 &C2 of SHEET2 and so on....

Is there any way to do this?? It would be great if it could be done with a CommandButton click....


Thanks in advance....plzz help mee...:(
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Try this...

Code:
Private Sub CommandButton1_Click()
Dim LR As Long
    With Sheets(2)
        LR = .Range("A" & Rows.Count).End(xlUp).Row + 1
        .Range("A" & LR) = Sheets(1).Range("A10").Value
        .Range("B" & LR) = Sheets(1).Range("B10").Value
        .Range("C" & LR) = Sheets(1).Range("C10").Value
    End With
End Sub
 
Upvote 0
Thank u very much buddy.. i got it!

Now a little more:biggrin:

If the value in A10 is a duplicate (of values only in column A ,SHEET2) , all the three values must not be entered and an message box should appear...

Can we do that??

Thanks a million
 
Upvote 0
Code:
Private Sub CommandButton1_Click()
Dim LR As Long
    With Sheets(2)
        LR = .Range("A" & Rows.Count).End(xlUp).Row + 1
        if .Range("A" & LR - 1) <> Sheets(1).Range("A10").value then
            .Range("A" & LR) = Sheets(1).Range("A10").Value
            .Range("B" & LR) = Sheets(1).Range("B10").Value
            .Range("C" & LR) = Sheets(1).Range("C10").Value
        Else
            Msgbox "Duplicate Values"
        End if
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,534
Messages
6,179,391
Members
452,909
Latest member
VickiS

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