Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Excel
#1
Ok as I say riddle me this batman. I am new to quick macros and have created a small one that works great. Here is my dillema, I want to open a user interface , which I have done, then I want to go excel move to a certain spot on the page, Completed, Now if that spot is empty stop running code if is not finish running the code then move down to the next line and start running code again. I want it to check column D and keep copying column D and pasting into a user interface in a non microsoft window, but then come back to the same spot in excel move down one and check if its empty before moving one basically. If not empty copy and paste again, if is empty then stop. If you know excel VBA I want wat to do a DO LOOP UNTIL ACTIVECELL.VALUE = "". Thanks.
#2
DO LOOP UNTIL ACTIVECELL.VALUE = ""
in QM is like this:
Macro Macro1267
Code:
Copy      Help
;/exe 1
act "Excel"
ExcelSheet es.Init

rep
,Excel.Range r=es.ws.Application.Selection
,str s=r.Value
,out s
,if(s.len=0) break
,key D
#3
Thanks for the code, but could you help me understand how it is working and what it is looking at? When I add it to my code it does not run correctly.
#4
It is an example. Shows how to repeat until an empty cell.
It displays selected cell, selects cell below it, and so on. Stops on an empty cell.
#5
I need it to run this code before it moves down.

'D Cc
Wait 3.0 s
3.0
lef 497 16 w3
act w1
lef+ 145 253 w1
lef- 145 252 w1
'Cv
lef 544 247 w1

So combined with your code it will not run all the way down my code. That is what I am trying to firgure out. I did this:

;/exe 1
act "Excel"
ExcelSheet es.Init

rep
,Excel.Range r=es.ws.Application.Selection
,str s=r.Value
,out s
,if(s.len=0) break
,'D Cc
Wait 3.0 s
3.0
lef 497 16 w3
act w1
lef+ 145 253 w1
lef- 145 252 w1
'Cv
lef 544 247 w1
,key D

But it was none too happy with it. Sad
#6
If code below ,'D Cc must be repeated, add tab or comma at the beginning of each line that must be repeated.
#7
Ok I will try give me a few minutes.
#8
If you want to copy cells from Excel and paste in another window, here is how to do it:

Macro Macro1269
Code:
Copy      Help
;/exe 1

;this code gets values of all selected cells
ExcelSheet es.Init
ARRAY(str) a; int i
es.GetCells(a "sel")

;this code types everything in Notepad
act "Notepad"
spe 10
for i 0 a.len
,str& s=a[0 i]
,key (s) Y

This is whole macro. Run it.
Before running this macro, select all cells in a row to be copied.
#9
lef+ 663 19 w3
lef- 663 20 w3
int w4=act(win("Microsoft Excel - Tyraid Template [Read-Only]" "XLMAIN"))
lef 345 193 w4

;/exe 1
act "Excel"
ExcelSheet es.Init

rep
,Excel.Range r=es.ws.Application.Selection
,str s=r.Value
,out s
,if(s.len=0) break
,'D Cc
, Wait 3.0 s
,3.0
,lef 497 16 w3
,act w1
,lef+ 145 253 w1
,lef- 145 252 w1
,'Cv
,lef 544 247 w1928312016

,key D


Ok on the above code i got it to work except for going back to the original excel spreadsheet. It moves over copy and paste but will not go back to -- int w4=act(win("Microsoft Excel - Fee Receivables Template [Read-Only]" "XLMAIN")). Am I missing that somewhere.


Forum Jump:


Users browsing this thread: 1 Guest(s)