Applescript excel copy paste repeat...

I'm trying to set up a simple applescript to copy a cell and paste it repeatedly down the column to the last record.
Can some one help?
The closest I could find is this:
tell application "Microsoft Excel"
  copy range range "I1"
  paste special range "I2:I5" what paste values
end tell
This works, but I need the script to determine the number of rows with data and paste that many times.

Glad to help!
A few things to add:
1.  You only need a tell...end tell for the whole script as you're only addressing the one app
2.  It would be useful to enclose the whole of the script (inside the tell Excel) in the
          tell active sheet of active workbook ... end tell
construction.
3.  At the end you can substitute the copy/paste special with:
          set (value of range ("F2:F" & rowCount)) to (get value of range ("E2:E" & rowCount))
4. If you do have a header row, then the following changes in the concatenation section (but, I suppose, given that it's going to be deleted it doesn't really matter!)
  set formula of cell "E2" to "=(IF(ISBLANK(D2),,C2&\" \"&D2))"
          fill down range ("E2:E" & rowCount)
It should end up looking like this:
tell application "Microsoft Excel"
          tell active sheet of active workbook
  -- remove unneeded columns
                    set mycolumns to range "M:ZZ"
  delete mycolumns
                    set mycolumns to range "D:G"
  delete mycolumns
                    set mycolumns to range "A:A"
  delete mycolumns
  -- Insert 2 columns to work with
  insert into range column 5
  insert into range column 5
  --contencate addresses from C&D into E
                    set formula of cell "ZZ1" to "=MATCH(REPT(\"z\",50),D:D)"
                    set rowCount to get value of cell "ZZ1" as integer
                    set value of cell "ZZ1" to ""
                    set formula of cell "E2" to "=(IF(ISBLANK(D2),,C2&\" \"&D2))"
                    fill down range ("E2:E" & rowCount)
  -- copy a Contencated address values to column F and delete columns C, D, E
                    set (value of range ("F2:F" & rowCount)) to (get value of range ("E2:E" & rowCount))
  delete column "C:E"
          end tell
end tell

Similar Messages

  • Excel copy / paste function does not work with Smartview

    We recently upgraded to latest version and this is the first tiime we are using Smartview. None of our users can use Excel copy / paste function between worksheets in a file or between files. The function only works within an active worksheet. What is the fix here?

    Try THis
    Disable the Transition formula evaluation and transition formula options.
    In Office 2003:
    1. Point to Tools -> Options...
    2. Select the Transition tab
    3. Deselect the following entries:
    - Transition formula evaluation
    - Transition formula entry
    4. Choose OK
    5. Repeat the above steps for each worksheet in the workbook, by selecting each one in turn adn repeating steps 1-4.
    In Office 2007:
    1. Point to the Office button
    2. Choose Excel Options
    3. Select Advanced (at the left)
    4. In the right-hand pane, scroll to the bottom
    5. Under Lotus Compatibility Settings for..., deselect:
    - Transition formula evaluation
    - Transition formula entry
    6. Select the next worksheet in the drop-down menu
    7. Repeat steps 5-6 until all worksheets have been processed
    8. Choose OK.

  • Framemaker 7.2 Windows XP SP3  Excel copy/paste

    After installing SP3 on Windows XP I find that I am no longer capable of doing a copy/paste of Excel tables in a Frame document. The result is a very small frame with no object inside.
    All worked fine when I unsintalled SP3 an I was able to create tables by copying them from Excel and using the Edition/Paste special in Frame.
    Anyone having same problem and found a solution other than uninstalling SP3
    Tks

    Two (sort of) workarounds:
    1. Use Edit > Paste Special (Rich Text Format). However, if you have color-shaded cells, they covert as black fill; in FM, changing the text in those cells to "white" is a workaround to the workaround. :|
    2. Copy/Paste the table into Word, Save As the Word to RTF, copy the table in Word then, in FM use Edit > Paste Special (Rich Text Format). Plain text and cell shading converts fine; however, calculated numbers get trashed. Another :|

  • Click 2 call and excel copy/paste problems

    Recent posts from late May claim that the click to call issues were resolved in late may. Today is June 21/12 and I resolved the problem yesterday by un-installing the click to call program. Prior to that cut and copy requests were losing the marquee around copied cells and when target cells were right clicked the context menu did not include Insert Copied cells. 
    Some problems may have been addressed but the problem still exists. It's too bad because click to call was a good feature.
    Solved!
    Go to Solution.

    The problem was identified and fixed already in an update to the Click to Call toolbar in April: http://blogs.skype.com/garage/2012/04/skype_click_to_call_fix_for_of.html
    *Best Solution* Download the new version of Skype Click to Call. It’s the quickest way to solve the copy & paste problem you are experiencing. Go to http://www.skype.com/intl/en-us/get-skype/on-your-computer/click-to-call/windows/ and click Download Now.
    Follow the latest Skype Community News
    ↓ Did my reply answer your question? Accept it as a solution to help others, Thanks. ↓

  • AppleScript Excel - Copy value of cells into variables

    I am super new to AppleScript, so please excuse me if I am not good at explaining what I am trying to do. I have an Excel file that has 12 columns and X rows, I need to have B2/C2/D2/etc copied into variables but have the column be a variable instead of a static number so I can write a loop to get all the rows, etc. Here is what I have now, and I know this is far from being correct.
    copy value of cell "B2" to varRow
    I have tried something crazy like this:
    copy value of column colSection of row intRow to varSection
    But that just throws up an error saying the object i am trying to access does not exist. I set the ColSection to "B" and intRow to 2, so I thought it would work. Any ideas or advice I am open! Thanks!

    The following should give you the idea:
    tell application "Microsoft Excel"
    activate
    make new workbook
    set myCol to 3 -- the starting column
    set myBgnRow to 2 -- the starting row
    set myString to "Hello World" -- characters to be inserted into sheet as sample values
    set myChar to 1 -- Points to first character ("H")
    set myEndRow to myBgnRow + (length of myString) - 1 -- the ending row
    -- Now put some values into the cells
    repeat with myRow from myBgnRow to myEndRow
    select (cell myCol of row myRow of active sheet)
    tell cell myCol of row myRow
    set value to character myChar of myString
    end tell
    set myChar to myChar + 1
    end repeat
    -- now get the values back out
    -- note that this is using same myBgnRow and myEndRow as above
    repeat with myRow from myBgnRow to myEndRow
    select (cell myCol of row myRow of active sheet)
    tell cell myCol of row myRow
    set myVal to value
    end tell
    display dialog (myCol as text) & "," & (myRow as text) & " " & myVal
    end repeat
    end tell

  • Copy/Paste more than 64K from Excel to Oracle Forms

    We need to copy from Excel more than 64K of data into Oracle Forms 10g. After the copy/paste action. The data will be split and saved in the database. The data contains 6000 fields of each 14 characters.
    What we tried: Create a Long field in forms (maximum size 64K) and process the data which is in this field. But by using PLSQL the maximum size is only 32K. So currently we can only copy and process 32K at a time.
    Is there a way to process over 64K from an excelsheet via Oracle Forms 10g R2?
    Can it be done via Java and how?
    Is it possible to read the clipboard in parts of 30K blocks and paste it in the Long field block with multirecords?
    Restrictions:
    We are not allowed to do file upload and process it on the server side.
    Thanks for your help!

    Hello,
    In the form, you can use Text Items that have datatype as long, so you can strore 64K.
    I do not understand the problem with the PL/SQL, because you can pass 32Ko chunks as many as needed.
    <p>Also, see this article</p>
    Francois

  • Copy the content of a sheet in excel and paste it in a new sheet.

    How can I copy the content of the first sheet in excel and paste it in a newly created sheet. Both sheets have specific names (not sheet1 and sheet2).
    Attachments:
    Repeat_Report_monday.vi ‏85 KB

    To copy the entire contents to the new sheet:
    Select the Target sheet by name using property Sheets->Item("Target")
    Convert target to WorkSheet
    Wire target's WorkSheet->Range("A1") to specify destination
    Use Sheets->Item("Source") to select the source sheet
    Convert source to WorkSheet
    Wire source to property WorkSheet->UsedRange
    Wire to method Range->Copy, wire target range to Desination input
    Note that no Paste function is required.
    Michael Munroe, ABCDEF
    Certified LabVIEW Developer, MCP
    Find and fix bad VI Properties with Property Inspector
    Attachments:
    Repeat_Report_monday_mod.vi ‏87 KB

  • Urgently Need Code for Copy & Paste from Html Table in JSP to Excel file

    I am creating a html table in JSP file .
    I need code for 'Cut,Copy,Paste' functions ie. if someone wants to copy data from my table to excel file or from excel file to html table he shud be able to do that.
    Can someone give me code for 'Cut,Copy and Paste' i.e. some javascript functions which can do cut, copy and paste which i can put in my jsp file
    Thanks
    Message was edited by:
    javatechguru2007

    package com.chinmayananda
    public class Tetris{
    // complete here
    code]
    public abstract class AbstractTetris {
       public abstract void start();
       public abstract void stop();
    }nearly done

  • Copy&paste from a file excel to Adobe Interactive Form

    Hi all
    my project is based on WDJ and Adobe Interactive Form.
    I need to know if it is possible to do a copy&paste from a file excel to my Adobe Interactive Form.
    Can I copy an area of data from an Excel spreadsheet (set of contiguous rows and columns)
    and paste them into a text field of my form, preserving the formatting (font, size, structure of coloums/rows,...)?
    Can you help me please?
    Thanks!

    You may try posting this question in either the Designer or Forms forum.
    This forum is for the LiveCycle PDF Generator ES product - a server side document conversion module.  If you want to convert the entire Excel spreadsheet to a PDF server side, then PDF Generator is the correct tool to use.

  • Copy & paste details in bookmarks (into excel)..?

    If you go to bookmarks > show all bookmarks, if you then click on a bookmark & copy it, only the address is copied, none of the other details in any visible columns e.g. 'Added', 'Visit Date' etc
    How can I copy & paste my bookmarks into a program like excel with all these details also tabulated...

    See also this MozillaZine forum thread.
    * http://forums.mozillazine.org/viewtopic.php?f=38&t=2515847

  • Excel 2007 "Hang" issue when copy/pasting.

    Hi.
    I have a user, using terminal services from a HP thin client. The server is a Windows server 2008 R2 SP1, Office 2007 SP3. The user is trying to copy from a IBM access session into Excel, sometimes the Excel will hang, an needs to be forcefully closed down
    using the Task Manager. I have made sure that the IBS Access is using the clipboard function on the server. Other users can copy/paste from this program without any issues. The server is fully updated and the office pack also.
    Any suggestions on where to start?
    Regards Martin

    Hi Martin,
    Thank you for posting in Windows Server Forum.
    Thus from your description it seems that particular user is facing the hangs issue, please correct me if there is anything misunderstand from my side.
    Does this happens for all Excel file with that user?
    Please try with RDP 8.1 for user and check the result. Please check the network connectivity is good. As user is copy pasting from IBM session it can create a little delay with file size or corrupt Excel file. The issue might also appear because the size for
    Excel sheet would be very high and thus during the logon time it will take a long time to open. Also it may take into hang issue for the users. In addition also check below link for information.
    What can cause slow copy and paste in Excel?
    http://blogs.technet.com/b/the_microsoft_excel_support_team_blog/archive/2011/09/08/what-can-cause-slow-copy-and-paste-in-excel.aspx
    Hope it helps!
    Thanks,
    Dharmesh

  • Registration Applications - Emai and Repeat Email - Disable Copy&Paste

    Hi,
    The standard behavior of Emai and Repeat Email field of Registration Applications allows Copy&Paste.
    I would expect to have standard behavior to not allow Copy&Paste otherwise 'Repeat' don't make sense. May i know the reason behind standard behavior Copy&Paste options for the Email fields?
    Can I disable Copy&Paste of the Email field by enhancement, if yes, how?
    ...Naddy

    Reposted with an additional quation Web Dynpro ABAP section...
    http://scn.sap.com/thread/3226810
    ...Naddy

  • Copy-paste values from excel sheet into variable screen of SAP BI 7.0 query

    Hello
    Report has selection by material in the variable screen. Users would like to to run a report for a set of materials (100+ items). He wants to copy-paste materials into material variable to avoid manual entry.
    I know its impossible. Are thee any ways to allow user not to enter this materials manually and run the report.
    Set of materials can change over the time.
    Thanks

    Hi,
    You might want to try with a text file (.txt).. place all the 100+ values into a text file.. like the notepad.. make sure you have only one column with all these number.. no headers or no blank spaces in the beginning..
    then, in the variable (variable should have been defined as "select options" or "multiple single values"), if you can go the screen where we can make multiple entries, we will have an option to import from a file.. and select the text file you have created above.. then all the 100+ values will be imported..
    we do this all the time..
    rgds
    Naga

  • Copy & paste embeded object to file system

    Cross-post at:
    http://stackoverflow.com/questions/27685791/copy-paste-embeded-object-to-file-system
    Background:
    I wrote a large piece of VBA code in an Excel workbook to help handle a lot of repeating jobs. I found it is painful to maintain and modify the code by using the "pool" VBA Editor. Then, I decided to move those VBA code to C# solutions, which I
    suppose I can benefit from the modern editor - Visual Studio.
    Problem:
    Although I don't know too much about VBA, I know even less about C#. Hence I got some problem when I try to "translate" my VBA code to C#, and here is one of them:
    I create a document-level solution for Excel. I need to embed some files (.cab, .exe) into the solution, so when I run a method (e.g. by clicking a button), those files will be copied to the file system, and do some job.
    In VBA, I embedded those files in the Excel workbook, then I can copy the embedded objects to the clipboard by using the following VBA code:
    Sheet1.OLEObjects("obj_cab").COpy
    And then I can paste the object to the file system by using the following VBA code:
    CreateObject("Shell.Application").Namespace("C:\Sample\").Self.InvokeVerb "Paste"
    In the C# solution, I can use the following equivalent method to copy the embedded object to the clipboard:
    Microsoft.Office.Interop.Excel.OLEObject OLEobj = (Microsoft.Office.Interop.Excel.OLEObject)sheet1.OLEObjects("obj_cab");
    OLEobj.Copy();
    Then I stuck here, I don't know how to get this object from clipboard and put it to the file system. The 'CreateObject' method does not exist in C#.
    Anyone can help? Either a better way to embed those files or a working way to paste those objects (files) from clipboard to the file system?
    Thanks a lot!

    Hi FantaC,
    It's possible to save the oleobject to the disk. But it's not very simple. Because when you call the Copy method of OLEObject to clipboard, it's actually not the exact the oleobject file itself, it's actually a wrapper of the file, it means that it has different
    file headers and some other information from the original oleobject file.
    To save oleobject on the disk, you need to analyze the byte array by yourself, this would be a little complicated. You could check the answer in this thread for the code sample:
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/1ab7a178-8021-4c67-a14b-5031a254fd9c/saving-oleobject-content-to-a-file
    The original poster of this thread also write a blogpost about this, you can check it here:
    Saving OLEObject Content To File
    Detailed information and code samples are provided in this blogpost.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Need help modifying Applescript to copy "Spotlight Comments" into file

    Hello all,
    I have a very large batch of images of Leonardo da Vinci's notebooks. I used the "Spotlight Comments" field of each file to save information about the notebook page depicted in each image:
    Well, I had to modify each image in Photoshop and when I saved the files, Photoshop of course didn't retain the Spotlight Comments. Now, before I modified the images, I duplicated the directory, so I have a copy of all of the images that retain their Spotlight Comments field with each image's information. What I want to do is copy the text from the Spotlight Comments field of the original files and either paste this text into the Spotlight Comments field of the modified files (which are in a different directory, but retain the same filenames as the originals), or at least copy the text from the Spotlight Comments field of the original files and paste each block of text into a txt file with a couple of blank lines in between each entry, so that I can manually copy/paste the citations into the modified image's Spotlight Comments fields.
    I successfully used this Applescript:  https://discussions.apple.com/message/6741062#6741062
    to get the Spotlight Comments from the original files, but it displays them one by one in pop-up dialog boxes and because I have almost a thousand images it is extraordinarily wearisome to copy the text from each pop-up, paste it into a text file, make two blank lines, click "OK" in the pop-up to get the next one...
    Can anyone suggest how I can modify the code I have to tell the Finder to copy the contents of each pop-up and paste them into a single text file with a couple of blank lines between each entry?
    I have the barest, most rudimentary knowledge of Applescript, which is why I'm asking if one of the wizards here can help me modify or write an Applescript to do what I need to do.
    Thank you so much!
    BTW, here is the code from the aforementioned discussion that gets the Spotlight Comments from files. I made into an Applescript application using Automator:
    tell application "Finder"
    repeat with tItem in input
    set (comment of tItem) to (text returned) of (display dialog "Spotlight Comment: " default answer (comment of tItem as string))
    end repeat
    end tell

    Hi,
    Evan Izer wrote:
    Now, before I modified the images, I duplicated the directory, so I have a copy of all of the images that retain their Spotlight Comments field with each image's information. What I want to do is copy the text from the Spotlight Comments field of the original files and either paste this text into the Spotlight Comments field of the modified files (which are in a different directory, but retain the same filenames as the originals)
    This script does exactly that:
    set sFolder to (choose folder "Select folder wich contains original images.") as string
    set dFolder to choose folder "Select folder wich contains modified images."
    tell application "Finder"
          repeat with tItem in (get document files of dFolder)
                set origFile to sFolder & (get name of tItem)
                if file origFile exists then
                      set origComment to comment of file origFile
                      set comment of tItem to origComment
                end if
          end repeat
    end tell

Maybe you are looking for