Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-09-2016, 05:00 PM
OldColdDreamer OldColdDreamer is offline Copy data btw worksheets using public arrays Windows 10 Copy data btw worksheets using public arrays Office 2013
Novice
Copy data btw worksheets using public arrays
 
Join Date: Feb 2016
Location: Stockport UK
Posts: 3
OldColdDreamer is on a distinguished road
Default

Thanks, Debaser. I think I am starting to get sorted out with my array and const declarations. Two quick follow-ons from this, though:

I want to call a sub (or a function?) when I try to leave a worksheet, which does some analysis of the data on that sheet, and leaves the results in various arrays.

What seems to work is the following coding...

In worksheet "Income" (aka "Sheet2"):
Private Sub worksheet_deactivate()
Call ThisWorkbook.Income_Deactivate
End Sub

In ThisWorkbook:
<various array and constant declarations (I'm happy with these now)>


Public Sub Income_Deactivate()
<sort the data into the arrays, maybe generate error messages>
End Sub

I seem to need the double-layer call in order to get my "deactivate()" code invoked when (say) the user clicks on the tab for another worksheet, and then do the processing where the arrays etc. are in scope. But is there a better way of achieving this?
In the event that my analysis finds an error, can I (maybe by using functions instead of subs) force the user to stay on the outgoing worksheet and fix the error?
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy data btw worksheets using public arrays Summing data from multiple worksheets in a workbook and placing into another worksheet safrac Excel 17 10-04-2022 12:21 PM
Can you copy & paste cells across worksheets and preserve reference to worksheet? New Daddy Excel 2 11-27-2013 07:19 AM
Copy data btw worksheets using public arrays Advanced Filter - Copy matching records in two worksheets morgantobin Excel 1 03-29-2013 03:58 AM
Finding sub-sets of data in worksheets Rudi Excel 3 01-28-2013 06:13 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:36 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft