ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sendkeys and wait variant (https://www.excelbanter.com/excel-programming/307491-sendkeys-wait-variant.html)

accountingboy

Sendkeys and wait variant
 
I'm running a macro with a sendkeys statement, followed by a past
command. However, I can't seem to get the wait variant to work? Th
paste is running before the sendkeys, and for the life of me I can'
figure this one out. Here's a snipit:
You can see where I've tried to run the wait seperate, but it run
BEFORE the sendkeys also.

Application.CutCopyMode = False
Selection.Cut
Range("D5").Select
Application.SendKeys "{END}{DOWN}{DOWN}", True

'Application.Wait (Now + TimeValue("0:00:02"))
Application.Run "PASTE"

Call me stupid, but I'm stuck

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Sendkeys and wait variant
 
Sub Tester2()
Selection.Cut Destination:=Range("D5").End(xldown)(2)
End Sub

--
Regards,
Tom Ogilvy


"accountingboy " wrote in
message ...
I'm running a macro with a sendkeys statement, followed by a paste
command. However, I can't seem to get the wait variant to work? The
paste is running before the sendkeys, and for the life of me I can't
figure this one out. Here's a snipit:
You can see where I've tried to run the wait seperate, but it runs
BEFORE the sendkeys also.

Application.CutCopyMode = False
Selection.Cut
Range("D5").Select
Application.SendKeys "{END}{DOWN}{DOWN}", True

'Application.Wait (Now + TimeValue("0:00:02"))
Application.Run "PASTE"

Call me stupid, but I'm stuck.


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 04:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com