#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 27
Default sendkeys string

I assigned a shortcut key to a macro using "ctrl" and a letter. The
following "sendkeys string:=" does not function as desired when using the
shortcut key. If I run the macro without the shortcut key, the macro runs
properly. Is there a remedy so that the macro may run using the shortcut
key? The macro line is as follows:

Sub lop()
For count = 1 To 3
SendKeys String:="={left}-4~{down}"
Next count
End Sub

--
l-hawk
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default sendkeys string

Try instead:

Sub lop()
For count = 1 To 3
SendKeys String:="={left}-4~{down}"
DoEvents
Next count
End Sub


The DoEvents is nice if you want to send keystrokes to more than one cell.
It alows time for the cells to accept the keys within the loop
--
Gary''s Student - gsnu200720


"hawki" wrote:

I assigned a shortcut key to a macro using "ctrl" and a letter. The
following "sendkeys string:=" does not function as desired when using the
shortcut key. If I run the macro without the shortcut key, the macro runs
properly. Is there a remedy so that the macro may run using the shortcut
key? The macro line is as follows:

Sub lop()
For count = 1 To 3
SendKeys String:="={left}-4~{down}"
Next count
End Sub

--
l-hawk

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 27
Default sendkeys string

The macro in the response does not help for the following spreadsheet format.

12 active cell (macro is run from the active cell)
22
44
--
l-hawk


"Gary''s Student" wrote:

Try instead:

Sub lop()
For count = 1 To 3
SendKeys String:="={left}-4~{down}"
DoEvents
Next count
End Sub


The DoEvents is nice if you want to send keystrokes to more than one cell.
It alows time for the cells to accept the keys within the loop
--
Gary''s Student - gsnu200720


"hawki" wrote:

I assigned a shortcut key to a macro using "ctrl" and a letter. The
following "sendkeys string:=" does not function as desired when using the
shortcut key. If I run the macro without the shortcut key, the macro runs
properly. Is there a remedy so that the macro may run using the shortcut
key? The macro line is as follows:

Sub lop()
For count = 1 To 3
SendKeys String:="={left}-4~{down}"
Next count
End Sub

--
l-hawk

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default sendkeys string

You don't need both the ~ and the down

In A1 thru A3 I enter:

12
22
44

I select B1 and run:

Sub lop()
For Count = 1 To 3
SendKeys String:="={left}-4~"
DoEvents
Next Count
End Sub

The macro enters the following formulas in B1 thru B3:

=A1-4
=A2-4
=A3-4


Is that want you want it to do??
--
Gary''s Student - gsnu200720
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 27
Default sendkeys string

Thanks for your assistance.

The results I received when I was positioned in cell B1, ran the macro by
holding down alt + f8, selecting the macro, and pressing enter is as follows
for column A and column B:

12 =A1-4
22
44

The results I receive when I ran the macro by using the shortcut key "ctrl +
t" is a single formula in cell A1 as follows. All other information was
erased.

=A1-4


--
l-hawk


"Gary''s Student" wrote:

You don't need both the ~ and the down

In A1 thru A3 I enter:

12
22
44

I select B1 and run:

Sub lop()
For Count = 1 To 3
SendKeys String:="={left}-4~"
DoEvents
Next Count
End Sub

The macro enters the following formulas in B1 thru B3:

=A1-4
=A2-4
=A3-4


Is that want you want it to do??
--
Gary''s Student - gsnu200720

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel charts do not update when using SendKeys nandan Charts and Charting in Excel 8 April 9th 07 06:14 PM
Application.SendKeys "%{down}" damorrison Excel Discussion (Misc queries) 3 June 3rd 06 09:09 PM
to search for a string and affect data if it finds the string? Shwaman Excel Worksheet Functions 1 January 11th 06 12:56 AM
SendKeys syntax problem VBAvirgin New Users to Excel 2 January 4th 06 04:42 PM
SendKeys function moglione1 Excel Discussion (Misc queries) 1 November 7th 05 02:57 PM


All times are GMT +1. The time now is 12:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"