Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel catching paste event 1

Status
Not open for further replies.

tytus2005

Programmer
Jul 5, 2005
16
PL
Hello!

Is there any way to catch paste event in excel vba. I mean - I need to catch it, check if there is any dollar sign and if so change the address, otherwise paste it without changes.

Any idea how to do it?


Best regards,
Tytus
 
not easily - no

what is it that you are trying to achieve ?

Rgds, Geoff

Three things are certain. Death, taxes and lost data. DPlank is to blame

Please read FAQ222-2244 before you ask a question
 
I have such problem:

In a cell there is a formula with constant $J$<row>, where row changes for each 20 rows. When someone is coping/pating a row I want to check is thers this formula and if so I want to find proper row number and replace it in formula. I'm trying to use change property and I think that is ok - I can check range object. The problem is that when I'm using Worksheetfunction.search/Worksheetfunction.find (Worksheetfunction.search("$J$",Target.cells(i,j).Formula)) I get RE 1004... Any idea what to do?? How vcan I check for $J$ in formula??
 
Rather than using worksheetfunctions - have a look at the INSTR() function within VBA as this returns a 0 or NULL if the string is not found


Rgds, Geoff

Three things are certain. Death, taxes and lost data. DPlank is to blame

Please read FAQ222-2244 before you ask a question
 
I decided to use a hidden column solution, so now there is no need to check what users are coping/pasting. Anyway it is nice to know that there is such a function in VBA (I don't have help files installed so actually it is really hard for me to check anything). Maybe I am wrong, but should any worksheets function be used in VBA code or it is better to use VBA function instead in any case?

Thx for help,

Best regards,

Tytus
 
It would generally be better to use a VBA function BUT there tend to be subtle differences in what would seem to be similar functions so you can get some different functionality by using worksheet functions within VBA.

Rgds, Geoff

Three things are certain. Death, taxes and lost data. DPlank is to blame

Please read FAQ222-2244 before you ask a question
 
Tytus,

You can essentially get VB Help on
Skip,
[sub]
[glasses] [red]Be advised:[/red]We know Newton's 3 Laws. But did you hear about the [red]FOURTH???[/red]
Only ONE fig per cookie![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top