View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Ryk Ryk is offline
external usenet poster
 
Posts: 36
Default sendkey help needed


Héctor Miguel wrote:
hi, Ryk !

Secondary question, what sendkey command does select all, copy etc?
Is there a list of sendkey commands somewhere?


your previously posted code [with minor corrections -uppercase-] is working [for me] as follows:

Sub GetData()
Dim Data As String
Data = ActiveCell.Value ' ANY NUMBER
' go down a row
ActiveCell.Offset(1, 0).Select
' flip back to previous window [THE CALCULATOR]
SendKeys "%{tab}", True
' enter the Data AND MULTIPLY IT BY 5
SendKeys Data & "*5{enter}", True
' get result
SendKeys "^c", True
' need next line to {ALT} tab back to last cell (IS working NOW)
SendKeys "%{tab}", True
' paste calculator result
SendKeys "^v{esc}"
End Sub

hth,
hector.


This is interesting as I read it, but I am unsure now how to change it
to fit, you see the data window has 2 tab stops, one to enter data,
then if I tab over and hit enter on a Run Data button, it processes the
info, (unlike calculator, with one cell) the problem is I do not know
how to make it tab back to the first cell, so I can re-run the macro
with new data. The calculator thing does work well, and I can use this
on another project i am sure, but for this one the tab to the left is
needed. I also dearly need a "copy all" for this, because the data,
when returned is in a list, and if I copy the sheet (external data
sheet) and paste to a blank excel sheet, the data I need is always in
same cell. My plan was this, copy the sheet, move it to blank sheet,
copy that cell, enter that on my Data sheet, delete the blank sheet,
and loop this. On my (sheet 1) the info I work this is column A, so
grab data (sheet 1) A1, flip to (external data sheet), paste (in first
cell), tab right hit enter, copy the (external data sheet), tab back
one left(to be ready for next loop), flip to excel blank excel
sheet(lets call it Sheet 2), paste, grab data from (Sheet 2) D14, move
back to (sheet 1), move one cell right. paste data, offset back to A
but down one row, clear data from (Sheet 2), and be ready to start it
all over. But as the external data sheet is not windows or excel, the
send keys have to be used in this. Hector, I hope this helps explain
better.

Dave