Copy data from one cell to another cell in a different sheet

Joined
May 6, 2011
Messages
13
Reaction score
0
Hi, I have looked everywhere and cannot seem to find an answer to this question.

I need to be able to copy a range to another cell in another sheet, but everytime I use this bit of code, the spreadsheet seems to muck up and close (it seems to switch between the 2 tabs at ultra fast speeds and then close).

this is my code:
Code:
If Range("C2").Value > "" then
     Range("C2").Copy
     Sheets("Step 2").Activate
     Range("C2").PasteSpecial
End if

I have also tried:

Code:
If Range("C2").Value > "" then
     Sheets("Step 2").Range("C2").Value = Sheets("Step 1").Range("C2")
End if
The above extracts of code do not seem to work as it should so please help.

Much appreciated, Cuddihy2k7
 
Joined
May 6, 2011
Messages
13
Reaction score
0
I have managed to get something working;

Code:
If Range("G4").Value > "" Then
    Sheets("Step 2 Reagent Metering Re-Cal").Range("H2").Value = Sheets("Step 1 Reagent Metering Test").Range("G4")
    Sheets("Step 3 Reagent Metering Re-Test").Range("G2").Value = Sheets("Step 1 Reagent Metering Test").Range("G4")
 
End if

But for some reason the code below doesn't work;

Code:
If Range("G5").Value > "" Then
    Sheets("Step 2 Reagent Metering Re-Cal").Range("H3").Value = Sheets("Step 1 Reagent Metering Test").Range("G5")
    Sheets("Step 3 Reagent Metering Re-Test").Range("G3").Value = Sheets("Step 1 Reagent Metering Test").Range("G5")
End If

Any suggestions, as it is basically exactly the same code, except the cells have changed.

The 1st piece of code provided is code to copy text from a cell, the 2nd piece of code is code to copy a number from a cell.
 
Joined
Sep 3, 2008
Messages
164
Reaction score
5
cuddihy2k7,

Have you tried catching the value of the cell in a variable? Psudocode:
Dim variable
variable = activesheet.cells("c2").value
switch focus to the other sheet and transfer the value

Stoneboysteve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top