Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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 properly. 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

Spreadsheet example:

21 active cell (macro is run from the active cell)
24
33


--
l-hawk
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default sendkeys string

On May 11, 9:17 am, hawki wrote:
I assigned a shortcut key to a macro using "ctrl" and a letter. The
following "sendkeys string:=" does not function properly. 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

Spreadsheet example:

21 active cell (macro is run from the active cell)
24
33

--
l-hawk


Hello Hawki,

If you want to move 4 cells to left and then down, try this...

Sub Lop()
For count = 1 To 3
SendKeys "{Left 4}"
SendKeys "{Down}"
Next count
End Sub

Sincerely,
Leith Ross

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

Thanks for your assistance.

My objective is to enter formulas in a column that have numbers in adjacent
cells in an adjacent column by entering an "=" sign, move to the "left" to
enter and address of the adjacent cell in an adjacent column, enter a "-"
sign, enter a "4", press the "enter" key, move "down" one cell in the same
column, repeat the action another 2 times.

--
l-hawk


"Leith Ross" wrote:

On May 11, 9:17 am, hawki wrote:
I assigned a shortcut key to a macro using "ctrl" and a letter. The
following "sendkeys string:=" does not function properly. 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

Spreadsheet example:

21 active cell (macro is run from the active cell)
24
33

--
l-hawk


Hello Hawki,

If you want to move 4 cells to left and then down, try this...

Sub Lop()
For count = 1 To 3
SendKeys "{Left 4}"
SendKeys "{Down}"
Next count
End Sub

Sincerely,
Leith Ross


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default sendkeys string

Any reason you can't just use the normal Excel object/methods ?
Only use SendKeys when you have no other option.

Activecell.Formula="=" & Activecell.offset(1.0).value & "-4"

Add your loop

NickHK

"hawki" wrote in message
...
Thanks for your assistance.

My objective is to enter formulas in a column that have numbers in

adjacent
cells in an adjacent column by entering an "=" sign, move to the "left" to
enter and address of the adjacent cell in an adjacent column, enter a "-"
sign, enter a "4", press the "enter" key, move "down" one cell in the same
column, repeat the action another 2 times.

--
l-hawk


"Leith Ross" wrote:

On May 11, 9:17 am, hawki wrote:
I assigned a shortcut key to a macro using "ctrl" and a letter. The
following "sendkeys string:=" does not function properly. 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

Spreadsheet example:

21 active cell (macro is run from the active cell)
24
33

--
l-hawk


Hello Hawki,

If you want to move 4 cells to left and then down, try this...

Sub Lop()
For count = 1 To 3
SendKeys "{Left 4}"
SendKeys "{Down}"
Next count
End Sub

Sincerely,
Leith Ross




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

Thanks a million!!

How would I move the cursor to one below the active cell?

--
l-hawk


"NickHK" wrote:

Any reason you can't just use the normal Excel object/methods ?
Only use SendKeys when you have no other option.

Activecell.Formula="=" & Activecell.offset(1.0).value & "-4"

Add your loop

NickHK

"hawki" wrote in message
...
Thanks for your assistance.

My objective is to enter formulas in a column that have numbers in

adjacent
cells in an adjacent column by entering an "=" sign, move to the "left" to
enter and address of the adjacent cell in an adjacent column, enter a "-"
sign, enter a "4", press the "enter" key, move "down" one cell in the same
column, repeat the action another 2 times.

--
l-hawk


"Leith Ross" wrote:

On May 11, 9:17 am, hawki wrote:
I assigned a shortcut key to a macro using "ctrl" and a letter. The
following "sendkeys string:=" does not function properly. 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

Spreadsheet example:

21 active cell (macro is run from the active cell)
24
33

--
l-hawk

Hello Hawki,

If you want to move 4 cells to left and then down, try this...

Sub Lop()
For count = 1 To 3
SendKeys "{Left 4}"
SendKeys "{Down}"
Next count
End Sub

Sincerely,
Leith Ross







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default sendkeys string

Activecell.offset(1,0).select


hawki wrote:

Thanks a million!!

How would I move the cursor to one below the active cell?

--
l-hawk

"NickHK" wrote:

Any reason you can't just use the normal Excel object/methods ?
Only use SendKeys when you have no other option.

Activecell.Formula="=" & Activecell.offset(1.0).value & "-4"

Add your loop

NickHK

"hawki" wrote in message
...
Thanks for your assistance.

My objective is to enter formulas in a column that have numbers in

adjacent
cells in an adjacent column by entering an "=" sign, move to the "left" to
enter and address of the adjacent cell in an adjacent column, enter a "-"
sign, enter a "4", press the "enter" key, move "down" one cell in the same
column, repeat the action another 2 times.

--
l-hawk


"Leith Ross" wrote:

On May 11, 9:17 am, hawki wrote:
I assigned a shortcut key to a macro using "ctrl" and a letter. The
following "sendkeys string:=" does not function properly. 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

Spreadsheet example:

21 active cell (macro is run from the active cell)
24
33

--
l-hawk

Hello Hawki,

If you want to move 4 cells to left and then down, try this...

Sub Lop()
For count = 1 To 3
SendKeys "{Left 4}"
SendKeys "{Down}"
Next count
End Sub

Sincerely,
Leith Ross






--

Dave Peterson
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
sendkeys string hawki Excel Discussion (Misc queries) 4 May 11th 07 08:30 PM
Always Sendkeys... Duncan[_5_] Excel Programming 0 May 4th 06 09:10 AM
SendKeys in VBA John Excel Programming 1 June 24th 05 05:46 PM
SendKeys? CMK Excel Programming 2 February 23rd 05 12:03 AM
SendKeys Ron de Bruin Excel Programming 3 August 25th 03 10:21 PM


All times are GMT +1. The time now is 11:53 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"