Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How to read previous copy selection address

Hallo! I'm looking for solution how to read previous copy selection address.
Is it possible in VBA in excel?
For instance:
1. select A1:B4
2. Ctrl + C
3 select G5
4 How to read this previous copy selection address (A1:B4)?
Thanks for any help, Adax

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default How to read previous copy selection address

On the menu bar:

EditOffice Clipboard

It appears in a panel window on the right of the screen.


"Adax" wrote in message ...
Hallo! I'm looking for solution how to read previous copy selection
address. Is it possible in VBA in excel?
For instance:
1. select A1:B4
2. Ctrl + C
3 select G5
4 How to read this previous copy selection address (A1:B4)?
Thanks for any help, Adax



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default How to read previous copy selection address

Adax,

VBA does not have a method to address non-string values of the clipboard.
But you can set up an event to capture the copy or cut - within a workbook,
but not between workbooks - and have that value available. Copy this
(somewhat tested, but not fully tested) code into the ThisWorkbook
codemodule:

Option Explicit
Dim myAdd1 As String
Dim myAdd2 As String
Dim CCAdd As String
Dim WasNotCopy As Boolean

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)

If myAdd1 < "" Then
myAdd2 = myAdd1
myAdd1 = Target.Address(True, True, xlA1, True)
Else
myAdd1 = Target.Address(True, True, xlA1, True)
myAdd2 = myAdd1
End If

If (Application.CutCopyMode = xlCopy Or _
Application.CutCopyMode = xlCut) And WasNotCopy Then
MsgBox "Clipboard has " & CCAdd
End If
If (Application.CutCopyMode = xlCopy Or _
Application.CutCopyMode = xlCut) And Not WasNotCopy Then
CCAdd = myAdd2
MsgBox "Clipboard has " & CCAdd
WasNotCopy = True
End If
If Application.CutCopyMode = False Then WasNotCopy = False
End Sub


HTH,
Bernie
MS Excel MVP


"Adax" wrote in message ...
Hallo! I'm looking for solution how to read previous copy selection
address. Is it possible in VBA in excel?
For instance:
1. select A1:B4
2. Ctrl + C
3 select G5
4 How to read this previous copy selection address (A1:B4)?
Thanks for any help, Adax


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How to read previous copy selection address

Użytkownik "Bernie Deitrick" <deitbe @ consumer dot org napisał w
wiadomo¶ci ...
Adax,
VBA does not have a method to address non-string values of the clipboard.
But you can set up an event to capture the copy or cut - within a
workbook, but not between workbooks - and have that value available. Copy
this (somewhat tested, but not fully tested) code into the
ThisWorkbook codemodule:
Option Explicit
Dim myAdd1 As String
Dim myAdd2 As String
Dim CCAdd As String
Dim WasNotCopy As Boolean
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Range)
If myAdd1 < "" Then
myAdd2 = myAdd1
myAdd1 = Target.Address(True, True, xlA1, True)
Else
myAdd1 = Target.Address(True, True, xlA1, True)
myAdd2 = myAdd1
End If
If (Application.CutCopyMode = xlCopy Or _
Application.CutCopyMode = xlCut) And WasNotCopy Then
MsgBox "Clipboard has " & CCAdd
End If
If (Application.CutCopyMode = xlCopy Or _
Application.CutCopyMode = xlCut) And Not WasNotCopy Then
CCAdd = myAdd2
MsgBox "Clipboard has " & CCAdd
WasNotCopy = True
End If
If Application.CutCopyMode = False Then WasNotCopy = False
End Sub
HTH,
Bernie
MS Excel MVP


Thank You very much! :)

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
How To Clear Previous Selection From a Drop Down The Griffster Excel Discussion (Misc queries) 3 September 22nd 10 09:36 PM
drop down list dependant of previous selection The Fru Fru Excel Worksheet Functions 1 December 3rd 08 03:33 AM
Copy Selection - Paste Selection - Delete Selection Uninvisible Excel Programming 2 October 25th 07 01:31 PM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM
Read previous line of textfile Adrian[_4_] Excel Programming 2 May 1st 04 04:20 AM


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