Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default "AfterPaste" event

I'm copying data from another program to excel 97. I need
a macro that run directly after i've pasted the data. The
WorkSheetChange event doesn't work.

Can someone help me please??

Thanks
Lars Kofod
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default "AfterPaste" event

Lars,
I checked for manual and VBA paste functions - the Worksheet_Change event
"should" work.
Can you verify if you have set Application.EnableEvents = False before the
paste action?

Alex J

"Lars Kofod" wrote in message
...
I'm copying data from another program to excel 97. I need
a macro that run directly after i've pasted the data. The
WorkSheetChange event doesn't work.

Can someone help me please??

Thanks
Lars Kofod



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default "AfterPaste" event

The worksheetchange event does work when I paste from
excel, but not from the program I need to paste from.

Application.EnabelEvents should that be true or false? I
haven't set it to either.

Thank you Alex J.

Lars Kofod
Denmark
-----Original Message-----
Lars,
I checked for manual and VBA paste functions - the

Worksheet_Change event
"should" work.
Can you verify if you have set Application.EnableEvents

= False before the
paste action?

Alex J

"Lars Kofod" wrote

in message
...
I'm copying data from another program to excel 97. I

need
a macro that run directly after i've pasted the data.

The
WorkSheetChange event doesn't work.

Can someone help me please??

Thanks
Lars Kofod



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default "AfterPaste" event

Lars,
Application.EnableEvents should be true, otherwise events (such as changes)
are ignored. If you have not been setting it to "off" in VBA to achieve
certain results, then that probably is not the source of your problem. (It
is reset when the Excel is restarted).

How about this:

In order to have the macro run after the other program (what is it, by the
way?) pastes to the Excel sheet, the following options seem logical:

1. Have the external application launch an Excel macro
2. Try to "fake" the event, or infer it
3. Have a button available for the user to manually kick off the macro.

I'll assume that 1 and 3 are yours

As far as 'faking' the event, two ideas come to mind:

1. Use the WorkSheet_SelectionChange Event to verify if new data has arrived
(try it)
2, Use the calculate event in the same way.

In order to detect if data has changed on the sheet, would it be reasonable
to assume that the sheet was previously (mostly) blank, and new pasted data
drastically increases the size of the used range? Why not try this program
on the Sheet Object:

Sub test()
Static n1 As Long
Dim nn As Long

nn = Application.WorksheetFunction.Subtotal(3, Me.UsedRange)

If nn < n1 Then
Msgbox "Found a Change"
n1 = nn
End If

End Sub

n1 is static, it holds its value between execution cycles of the program
The function is pretty fast
Instead of using "3" in the subtotal to count cells, try "9" to sum cell
values?

Hope this points in a creative direction for you.

Alex J

"Lars Kofod" wrote in message
...
The worksheetchange event does work when I paste from
excel, but not from the program I need to paste from.

Application.EnabelEvents should that be true or false? I
haven't set it to either.

Thank you Alex J.

Lars Kofod
Denmark
-----Original Message-----
Lars,
I checked for manual and VBA paste functions - the

Worksheet_Change event
"should" work.
Can you verify if you have set Application.EnableEvents

= False before the
paste action?

Alex J

"Lars Kofod" wrote

in message
...
I'm copying data from another program to excel 97. I

need
a macro that run directly after i've pasted the data.

The
WorkSheetChange event doesn't work.

Can someone help me please??

Thanks
Lars Kofod



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default "AfterPaste" event

Sorry Lars,
I meant to say that the small routine I called Test should in fact sun under
the WorkSheet_Calculate event. That way is will check regularly for a change
Alex J

"Alex J" wrote in message
...
Lars,
Application.EnableEvents should be true, otherwise events (such as

changes)
are ignored. If you have not been setting it to "off" in VBA to achieve
certain results, then that probably is not the source of your problem. (It
is reset when the Excel is restarted).

How about this:

In order to have the macro run after the other program (what is it, by the
way?) pastes to the Excel sheet, the following options seem logical:

1. Have the external application launch an Excel macro
2. Try to "fake" the event, or infer it
3. Have a button available for the user to manually kick off the macro.

I'll assume that 1 and 3 are yours

As far as 'faking' the event, two ideas come to mind:

1. Use the WorkSheet_SelectionChange Event to verify if new data has

arrived
(try it)
2, Use the calculate event in the same way.

In order to detect if data has changed on the sheet, would it be

reasonable
to assume that the sheet was previously (mostly) blank, and new pasted

data
drastically increases the size of the used range? Why not try this program
on the Sheet Object:

Sub test()
Static n1 As Long
Dim nn As Long

nn = Application.WorksheetFunction.Subtotal(3, Me.UsedRange)

If nn < n1 Then
Msgbox "Found a Change"
n1 = nn
End If

End Sub

n1 is static, it holds its value between execution cycles of the program
The function is pretty fast
Instead of using "3" in the subtotal to count cells, try "9" to sum cell
values?

Hope this points in a creative direction for you.

Alex J

"Lars Kofod" wrote in message
...
The worksheetchange event does work when I paste from
excel, but not from the program I need to paste from.

Application.EnabelEvents should that be true or false? I
haven't set it to either.

Thank you Alex J.

Lars Kofod
Denmark
-----Original Message-----
Lars,
I checked for manual and VBA paste functions - the

Worksheet_Change event
"should" work.
Can you verify if you have set Application.EnableEvents

= False before the
paste action?

Alex J

"Lars Kofod" wrote

in message
...
I'm copying data from another program to excel 97. I

need
a macro that run directly after i've pasted the data.

The
WorkSheetChange event doesn't work.

Can someone help me please??

Thanks
Lars Kofod


.





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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
automatically updating "school event record" formula hiddenaddy Excel Worksheet Functions 0 January 9th 06 08:36 PM


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