Jump to content

Manipulating Excel


AzgarD
 Share

Recommended Posts

Hi guys. I know this is a newbie topic, very newbie, but i've read a lot of stuff and still don't get it. I just need to copy something from Excel cell, paste this in other program, copy something in this program and paste in other Excel cell. Something like...

Copy A2
Use some WindowActivate and MouseMove stuff and CTRL+C (not a problem)
Go back to the Excel sheet
Paste that content in C2

Then

Copy A3
Use some WindowActivate and MouseMove stuff and CTRL+C (not a problem)
Go back to the Excel sheet
Paste that content in C3

...

And it goes on

The problem is, how can i "communicate" with Excel and do this row change? Like A2 to C2 and A3 to C3 ... In a efficient way that can be done like hundreds of times.
Very newbie question but still not understanding this.
 

Ty guys.

Link to comment
Share on other sites

Supose i want to manipulate a already open Excel sheet, like "Sample. xlsx", what should i do?

I'm very confuse about how to communicate with a specific and already open sheet. 

Sorry about the newbie questions.

Link to comment
Share on other sites

Check _Excel_BookAttach to connect to an already opened workbook.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

31 minutes ago, water said:

Check _Excel_BookAttach to connect to an already opened workbook.

Nice. I'm understanding now.

Two more questions...

1 - How can i "navigate" between specific rows and colums?
2 - How can i copy and paste stuff in the sheet?

Again, sorry for the trouble and the newbie questions.
 

Link to comment
Share on other sites

You do not need to navigate to cells, because you specify the range to process in the _Excel_* Statements.
Copy/Paste: _Excel_RangeCopyPaste.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

3 minutes ago, water said:

You do not need to navigate to cells, because you specify the range to process in the _Excel_* Statements.
Copy/Paste: _Excel_RangeCopyPaste.

Got it, but that way i can't loop using variables right?

Using a C++ exemple :

 

While (0 = 0)
{
code...
code...
code...
i++;
}

// variable i being a row for exemple

 

Link to comment
Share on other sites

You can read the entire used range of a worksheet into an array and then process the array (this faster then reading row by row).

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • 2 months later...

If you have excel sheet object, then you can loop through the cells like this ;

; Assuming that $xlSheet is your sheet object.
Local $LastUsedRow = $xlSheet.Range("A" & .Rows.Count).End(Excel.XlDirection.xlUp).Row ; You an use any column letter
Local $YourColumn = 2 ; You can use any column number here.
For $i = 1 To $LastUsedRow
    Local $cellData = $xlSheet.Cells($i, $YourColumn).Value
Next

 

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
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
 Share

×
×
  • Create New...