Search : in
By :

Copy text from one work sheet to another

Last answer on Aug 17, 2009 4:21:14 pm BST meljam, on Apr 5, 2009 11:44:06 am BST 
 Report this message to moderators

Hello, Could some one help explain how I can simply copy text from a cell in a different work sheet. I'm trying to make a report using the months of the year. As the rolling performance indicators more on I need to have a cell look for the month in another work sheet and fill in the blanks. i.e. I have worksheet1 with cell A2 needing to be populated, I habe work sheet 2 with the data. Could someone help me understand What is required.

Many Thanks in advance.

Configuration: Windows Vista
Internet Explorer 7.0

Best answers for « copy text from one work sheet to another » in :
Writing in batch in text file ShowWriting in batch in text file To write in a file text, you just have to use a redirect: echo text > output_file.txt To write in an existing file: echo " Write at the end of the file ">> output_file.txt
Adding a VBA CommandButton with its respective the code ShowAdding a VBA CommandButton with its respective the code Paste these two sub in a general module (Module1 for example). Sub CreateButton() Dim Obj As Object Dim Code As String Sheets("Sheet1").Select 'create button ...
Inserting text in a file ShowInserting text in a file Introduction Syntax Introduction It is sometimes useful to insert text in the header of one or more document (s) or in a specific part of the document (before or after a specific line). The publisher of...
Download Pochette Express ShowDescription: "Pochette Express" is a software to print on one sheet, front and back cover of your CD, DVD, Mini Disc and VHS, to print the exact size. Features: "Pochette Express" offers standard sizes but can also create a custom format, it...
Download DVD decrypter ShowIn France, it is legal to have a backup copy of one’s video supports for a private use. DVDDecrypter allows to rip (to extract) encrypted DVD on the hard disk in order to exploit its contents. This software allows to rip each track or extract an ISO...
UNIX Commands ShowTable of the main UNIX commands Unix Commands Description Options ls lists the content of a directory -a Displays all files, including hidden files -I Displays a...
Using FTP commands ShowThe FTP protocol FTP (File Transfer Protocol) is a protocol — meaning a standard language that lets two machines communicate — used so that computers of different types (or with different operating systems) can transfer files over a...
Declaring a style sheet (CSS) ShowDeclaring a style sheet Style sheets are not directly integrated into the W3C's HTML recommendations. For this reason, you need to include elements in the HTML code indicating both the type of document, meaning the version of the HTML and CSS...

1

Austin, on Apr 10, 2009 6:24:45 pm BST
  • +1

In sheet1 cell A2 if sheet2 cell A4 has the data:

='sheet2'!A4

Reply to Austin

2

 SenHu, on Aug 17, 2009 4:21:14 pm BST

Hello meljam

If you want to do this automatically without manually opening the spreadsheet program, you can write a script for that. Save the files as CSV (Comma Separated Values) or TSV (Tab Separated Values). Excel will work with both. I will assume TSV.

Here, then, is the synopsis of the problem. We want to copy cell A2 (second row, first column) from C:/file1.csv to C:/file2.csv.



# Script A2.txt
# Read file1.
var str content1 ; cat "C:/file1.csv" > $content1
# Get second row of content1.
var str row2 ; lex -e "2" $content1 > $row2
# Get first column of row2.
var str column1 ; wex -e "1" $row2 > $column1
# We now have the value of cell A2 in $column1. Read file2.
var str content2 ; cat "C:/file2.csv" > $content2
# Extract the first row of content2 unchanged into output.
var str output ; lex -e "1]" $content 2 > $output
# Put in the extracted value of cell A2.
echo "\n" $column1 "\t" >> $output
# Put in the rest of data from content2.
wex -e "[2" $content2 >> $output
# Output is ready. Write it back to file2.
echo $output > "C:/file2.csv"
# Done.




Script is in biterscripting ( http://www.biterscripting.com ) . To try, save the script as C:/Scripts/A2.txt, start biterscripting, enter the following command.



script A2.txt


The script can also be called from the task scheduler, if you want to schedule a monthly task. I am calling the script A2 because, we want to extract cell A2 here. But, you can change the script to extract any other cell, or even multiple cells.

Sen

Reply to SenHu