Sign in to follow this  
Followers 0
jerimy

Autoit and Excel Copy and Paste

10 posts in this topic

Hi all, I have an excel program in which there is a pivot table in which the J column will exclude what is in the pivot table. I need to write a script(with a hotkey)1. Open the minimize excel sheet I have open. 2. Take the first symbol in the pivot table which is P7 and put it into the J column. The problem is that I always have symbols in the J colum and I need the script to copy the symbol and always paste it the next row. For instance if I have info from J1 to J20 I need the script to copy and paste the info in J21, then when I hit the Hotkey again I need it to put the next symbol in J22. Anyone have any ideas of how to do this? Thanx for the help!!!

Share this post


Link to post
Share on other sites



Hi all, I have an excel program in which there is a pivot table in which the J column will exclude what is in the pivot table. I need to write a script(with a hotkey)1. Open the minimize excel sheet I have open. 2. Take the first symbol in the pivot table which is P7 and put it into the J column. The problem is that I always have symbols in the J colum and I need the script to copy the symbol and always paste it the next row. For instance if I have info from J1 to J20 I need the script to copy and paste the info in J21, then when I hit the Hotkey again I need it to put the next symbol in J22. Anyone have any ideas of how to do this? Thanx for the help!!!

Read the sheet into an array with $avArray = _ExcelReadSheetToArray($oExcel) and you get:

$avArray[0][0] = last row number

$avArray[0][1] = last col number

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Read the sheet into an array with $avArray = _ExcelReadSheetToArray($oExcel) and you get:

$avArray[0][0] = last row number

$avArray[0][1] = last col number

:D

thanx for the reply but fairly new in writing scripts in autoit. Will this copy and paste for me? Sorry I dont know how to write this

Share this post


Link to post
Share on other sites

thanx for the reply but fairly new in writing scripts in autoit. Will this copy and paste for me? Sorry I dont know how to write this

No, that gives you the number of rows and columns used, which you seemed to be trying to figure out. The actual copying is trivial. Look at the other _Excel* functions in the help file.

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Have a look at this UDF.

http://www.autoitscript.com/forum/index.php?showtopic=34302&hl=_ExcelCOM_UDF&st=0

It has copy and paste function.

_ExcelCopy($oExcel, 1, 1 , 1, 1)
_ExcelPaste($oExcel, 1,1)

Use PsaltyDS's code posted above to get the row and column for the copy & paste parameter.


[font="Palatino Linotype"][size="2"]*** The information contained in this post should be considered and certified WORKS ON MY MACHINE ***[/size][/font][font="Palatino Linotype"][size="2"] [/size][/font]

Share this post


Link to post
Share on other sites

Have a look at this UDF.

http://www.autoitscript.com/forum/index.php?showtopic=34302&hl=_ExcelCOM_UDF&st=0

It has copy and paste function.

_ExcelCopy($oExcel, 1, 1 , 1, 1)
_ExcelPaste($oExcel, 1,1)

Use PsaltyDS's code posted above to get the row and column for the copy & paste parameter.

Most of Locodarwin's UDF is now part of the AutoIt's standard set of includes as Excel.au3 -- see the _Excel* functions in the current help file.

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Yes, but _ExcelCopy(), _ExcelPaste() and the others are not yet included in the Excel.au3 in current help file v3.3.1.1 (beta). :D

Edited by nfaustin

[font="Palatino Linotype"][size="2"]*** The information contained in this post should be considered and certified WORKS ON MY MACHINE ***[/size][/font][font="Palatino Linotype"][size="2"] [/size][/font]

Share this post


Link to post
Share on other sites

Yes, but _ExcelReadCell and _ExcelWriteCell are in there, which would serve his purposes just fine, without using the clipboard.


The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites

I have the same "type" of problem, only it has a bit of a twist to it. And it is driving me insane!

1. I have one column in an Excel workbook called "Index" that has a list of text, this column has 2000 rows each with a unique entry.

2. I have worksheets, 2000 of them, and each tab is named to match each cell in the in the Index worksheet all in the same workbook.

3. I need to copy the first cell

4. Paste that text into a different program in a search window.

5. Press enter

6. Select the results

7. Press ctrl + a to copy everything in the results window

8. Take the results back to Excel to the matching worksheet and paste it in column A, row 1

9. Loop through this until it has gone to each cell in the Index work sheet.

I know for you guys who do this all the time it is probably a simple script to code out, but for me I do not have the skill set to accomplish this with. If I do this manually, which I have been doing, it is going to take a VERY long time. Any help that could be given would be highly appreciated. Thanks everyone.

Share this post


Link to post
Share on other sites

#10 ·  Posted

Please open a new thread. You necro a nearly 5 years old thread :)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0