Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default OnKey and Range Question


Is it possible to take a range from one worksheet and place it in
another in the same spreadsheet (without copying and pasting)?

For example something similar to this:

-----
Sub test()
Dim rng As Range
Set rng = Worksheets(1).Range("A1", "C4")

Worksheets(2).Range("B1", "D4") = rng
End Sub
-----

I was also wondering how to make 'onKey' work for both Mac and PC.
I've got code running on my Mac in a Personal Macro Workbook as so
(which uses the keystroke Command-Option-Shift-j):

-----
Sub Auto_Open()
Application.OnKey "+%*j", "test"
End Sub
-----

I haven't tested it on a PC but was wondering what the best approach
was if I still want to use the 'Command' button on a Mac. I'm using
Mac OS 10.3 and 10.4 with Excel 98 and Excel 2004.

Thanks.

Jay


--
jayy
------------------------------------------------------------------------
jayy's Profile: http://www.excelforum.com/member.php...o&userid=33975
View this thread: http://www.excelforum.com/showthread...hreadid=537494

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default OnKey and Range Question

Sub test()
Dim rng As Range
Set rng = Worksheets(1).Range("A1", "C4")
Worksheets(2).Range("B1", "D4").Value = rng.Value
End Sub

worked for me.


You would need to use an IF statement and write the appropriate sendkey
combination based on the operating system

? application.OperatingSystem
Windows (32-bit) 4.10


from help on OperatingSystem property:
Returns the name and version number of the current operating system ¾ for
example, "Windows (32-bit) 4.00" or "Macintosh 7.00". Read-only String.

--
Regards,
Tom Ogilvy


"jayy" wrote in message
...

Is it possible to take a range from one worksheet and place it in
another in the same spreadsheet (without copying and pasting)?

For example something similar to this:

-----
Sub test()
Dim rng As Range
Set rng = Worksheets(1).Range("A1", "C4")

Worksheets(2).Range("B1", "D4") = rng
End Sub
-----

I was also wondering how to make 'onKey' work for both Mac and PC.
I've got code running on my Mac in a Personal Macro Workbook as so
(which uses the keystroke Command-Option-Shift-j):

-----
Sub Auto_Open()
Application.OnKey "+%*j", "test"
End Sub
-----

I haven't tested it on a PC but was wondering what the best approach
was if I still want to use the 'Command' button on a Mac. I'm using
Mac OS 10.3 and 10.4 with Excel 98 and Excel 2004.

Thanks.

Jay


--
jayy
------------------------------------------------------------------------
jayy's Profile:

http://www.excelforum.com/member.php...o&userid=33975
View this thread: http://www.excelforum.com/showthread...hreadid=537494



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default OnKey and Range Question


Hi Tom,

Thanks so much for your fast reply! This is exactly what I wa
needing! Thanks again for taking the time to help.

Ja

--
jay
-----------------------------------------------------------------------
jayy's Profile: http://www.excelforum.com/member.php...fo&userid=3397
View this thread: http://www.excelforum.com/showthread.php?threadid=53749

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
OnKey Hernan Excel Programming 2 January 11th 06 04:18 PM
Help with using OnKey keithb Excel Programming 1 December 19th 05 11:03 PM
onkey help wardy Excel Programming 0 July 20th 04 05:49 PM
onkey peter Excel Programming 2 March 2nd 04 07:34 PM
Onkey Jase Excel Programming 1 November 17th 03 11:07 PM


All times are GMT +1. The time now is 03:47 PM.

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

About Us

"It's about Microsoft Excel"