ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Shift+Del buffer (https://www.excelbanter.com/excel-programming/397822-shift-del-buffer.html)

John Svendsen

Shift+Del buffer
 
Hi All:

Is there any way to capture what has been placed in the Shift+Del buffer?
I'd like to create a Macro to do the following:
-Edit a cell (F2)
-Select a range of text in the cell (highlighted text)
-Run this macro:
--which asks for text to replace the selected text
--stores the "find" and the "replace" strings to a file
I was able to do this for Word (code below), but what gets me is how to
assign a Selection to copy in Excel - the simplest thing I've thought of was
to use the Shift+Del / Shift+Insert buffer - is this possible?
TIA, JS

==============================================
Sub AltQMacro5()
Dim Twhat As String, Twith As String
Twhat = Selection.Text: Twith = InputBox("Enter text to replace SELECTED
text", , Twhat, 0, 0)
Selection.Find.ClearFormatting:
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = Twhat: .Replacement.Text = Twith
.Forward = True: .Wrap = wdFindContinue
.Format = False: .MatchCase = True: .MatchWholeWord = True
.MatchKashida = False: .MatchDiacritics = False: .MatchAlefHamza =
False
.MatchControl = False: .MatchByte = False: .CorrectHangulEndings =
False
.MatchWildcards = False: .MatchSoundsLike = False:
..MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Open "C:\MacroALQ.txt" For Append Access Write As #1
Print #1, Twhat & "¡" & Twith & "¡" & Format(Date, "yyyy-mm-dd") & "¡" &
Format(Time, "hh:mm:ss") & "¡" & ActiveDocument.Name
Close #1
End Sub





All times are GMT +1. The time now is 03:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com