#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Calculation

I have the following code in Worksheet SelectionChange
"Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Worksheets(2).Calculate
End Sub"

This for some reason disallows Paste, PasteSpecial and some other features.
Macros having copy and paste fail. I am now trying to have the calculation
applicapable to rows 1 to 341. I amended the code to the following, but the
recalculation is effective only on row 341.
"Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Worksheets(2).Rows(341).Calculate
End Sub"

Any assistance. Thank you

Robert
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Calculation


"Robert" schrieb im Newsbeitrag
...
I have the following code in Worksheet SelectionChange
"Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Worksheets(2).Calculate
End Sub"

This for some reason disallows Paste, PasteSpecial and some other
features.
Macros having copy and paste fail. I am now trying to have the calculation
applicapable to rows 1 to 341. I amended the code to the following, but
the
recalculation is effective only on row 341.
"Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Worksheets(2).Rows(341).Calculate
End Sub"

Any assistance. Thank you

Robert


Robert,

try Worksheets(2).Rows("1:341").calculate.

cheers,
Stephan


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Calculation

Hi Robert,

This for some reason disallows Paste, PasteSpecial and some other
features.


Much macro activity clears the clipboard.

Macros having copy and paste fail.


Rewrite the code to ensure that the paste operation follows the copy
operation without any intervening operations. As noted above, such
intervening operations may clear the clipboard and cause the problems you
report.

---
Regards,
Norman

"Robert" wrote in message
...
I have the following code in Worksheet SelectionChange
"Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Worksheets(2).Calculate
End Sub"

This for some reason disallows Paste, PasteSpecial and some other
features.
Macros having copy and paste fail. I am now trying to have the calculation
applicapable to rows 1 to 341. I amended the code to the following, but
the
recalculation is effective only on row 341.
"Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Worksheets(2).Rows(341).Calculate
End Sub"

Any assistance. Thank you

Robert



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Calculation

Thank you Norman, Everthing now works well.
Dr. Stephan, thank you for your input. Points noted.
--
Robert



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Calculation

In my earlier message, the addressees have been transposed.
Sorry Dr. Stephan, in my haste got mixed.
--
Robert





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Calculation


"Robert" schrieb im Newsbeitrag
...
In my earlier message, the addressees have been transposed.
Sorry Dr. Stephan, in my haste got mixed.
--
Robert



Robert,

no problem, it's still early (at least for me ;-)

Just out of curiosity - is there a particular reason you trigger the
calculation each time the selection changes? This is a higly inefficient
approach as no values change by selecting another cell.

Stephan


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Calculation

Dr. I am embarrased to say the file I have with a lot of VLOOKUPs is 48Mb. My
sheet(2) in reference is actually a Data Entry Screen which does
calculations and more than 40 different values values are then posted to
other sheets. The data in these sheets need not be processed real-time. When
calculation is set to auto it took an intolerably long time before the "entry
screen" is ready for the next entry. I will later check for what may be
causing the delay.


Robert
PS. You would have guessed, I do not know any VBA.


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Calculation


"Robert" schrieb im Newsbeitrag
...
Dr. I am embarrased to say the file I have with a lot of VLOOKUPs is 48Mb.
My
sheet(2) in reference is actually a Data Entry Screen which does
calculations and more than 40 different values values are then posted to
other sheets. The data in these sheets need not be processed real-time.
When
calculation is set to auto it took an intolerably long time before the
"entry
screen" is ready for the next entry. I will later check for what may be
causing the delay.


Robert
PS. You would have guessed, I do not know any VBA.



Dear Robert,

just my 2cent. You are currently using the SelectionChange event which is
fired each time you change the selection. You can recalculate your sheet
each time a *change* occurs by using the Change event like

Private Sub Worksheet_Change(ByVal Target As Range)

End Sub

Further speed can be achieved by testing whether Target (the cell where the
change occurs) intersects with your data entry cells thus irrelevant changes
do not force a recalculation.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not (Intersect(Range("A1:A5"), Target) Is Nothing) Then
MsgBox "Change in cell A1-A5"
Exit Sub ' or recalculate
' else do nothing
End If
End Sub

cheers,
Stephan


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
Multi threaded calculation (multi CPU) - impact on calculation spe Pascal[_2_] Excel Discussion (Misc queries) 1 December 3rd 08 10:46 AM
Calculation Stewart Excel Worksheet Functions 3 March 16th 07 10:18 PM
How do I use a rounded calculation result in another calculation? vnsrod2000 Excel Worksheet Functions 1 January 26th 05 10:11 PM
How do I use a rounded calculation result in another calculation? vnsrod2000 Excel Worksheet Functions 1 January 26th 05 09:36 PM
range.calculation with UDF not working when calculation is set to automatic Brian Murphy Excel Programming 5 October 14th 03 07:02 PM


All times are GMT +1. The time now is 02:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"