Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How To Clear Previous Selection From a Drop Down | Excel Discussion (Misc queries) | |||
drop down list dependant of previous selection | Excel Worksheet Functions | |||
Copy Selection - Paste Selection - Delete Selection | Excel Programming | |||
Copy Selection - Transpose Selection - Delete Selection | Excel Discussion (Misc queries) | |||
Read previous line of textfile | Excel Programming |