PC Review


Reply
Thread Tools Rate Thread

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

 
 
New Member
Join Date: May 2011
Posts: 12
 
      27th Jul 2011
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
 
Reply With Quote
 
 
 
 
New Member
Join Date: May 2011
Posts: 12
 
      27th Jul 2011
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.
 
Reply With Quote
 
Senior Member
Stoneboysteve's Avatar
Join Date: Sep 2008
Location: USA
Posts: 131
 
      27th Jul 2011
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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy rows from one Data sheet to another sheet based on cell conte John McKeon Microsoft Excel Misc 2 15th May 2010 06:49 AM
Auto copy cell data from source sheet to another wrkbook sheet IVLUTA Microsoft Excel Programming 2 2nd Jun 2009 05:07 PM
Copy last cell with data in column E on one sheet to cell on anoth Seahawk Microsoft Excel Worksheet Functions 7 7th May 2009 02:52 AM
copy data of two cells from Sheet 2 into one cell in Sheet 1 cahabbinga Microsoft Excel Worksheet Functions 6 30th Jan 2008 01:00 PM
how to copy a cell with formula from sheet 1 (data is all vertical) into sheet 2 parag Microsoft Excel Worksheet Functions 3 15th Jun 2006 10:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:06 AM.