Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default How to Pass Control from VBA to user and return

I would like to pass program control from a VBA macro to a user on a
particular sheet, let the user do whatever, then return control to VBA and
pick up where I left off with all my VBA variables/pointers intact.

I think the answer is "Design it a different way", but I thought I'd ask
since I would prefer to the let the user process the data in the already
complex spreadsheet, instead of having to dupe all the formulas in vba.


thanks,

tim
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default How to Pass Control from VBA to user and return

Hi Tim,

You were not very specific in what you want the VBA code to do, but I think
you should look into putting the code in the Worksheet_Change Event
This is trigerred every time a user makes a Change to the Worksheet, so you
dont have to launch a Macro & then worry about having to have the focus go
back to the user. You should be able to accomplish what you want using this
event. You can even track what cell the user is in.

Also see SelectionChange Event & other Events for Worksheet

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
' Set the row containing the active cell to bold.
ActiveCell.EntireRow.Font.Bold = True
End Sub


Jeff

Private Sub Worksheet_Change(ByVal Target As Range)
MsgBox "C"
End Sub

"needyourhelp" wrote:

I would like to pass program control from a VBA macro to a user on a
particular sheet, let the user do whatever, then return control to VBA and
pick up where I left off with all my VBA variables/pointers intact.

I think the answer is "Design it a different way", but I thought I'd ask
since I would prefer to the let the user process the data in the already
complex spreadsheet, instead of having to dupe all the formulas in vba.


thanks,

tim

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default How to Pass Control from VBA to user and return

The foregoing may be preferred, but another method might be to launch a
non-modal userform which loads up form level variables, then gets hidden,
then might get "show"n again on some sort of workbook_change event (if a
test of whether it is loaded is true). Sounds complicated, maybe I am crazy,
it's a shot in the dark.

"Jeff" wrote in message
...
Hi Tim,

You were not very specific in what you want the VBA code to do, but I
think
you should look into putting the code in the Worksheet_Change Event
This is trigerred every time a user makes a Change to the Worksheet, so
you
dont have to launch a Macro & then worry about having to have the focus go
back to the user. You should be able to accomplish what you want using
this
event. You can even track what cell the user is in.

Also see SelectionChange Event & other Events for Worksheet

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
' Set the row containing the active cell to bold.
ActiveCell.EntireRow.Font.Bold = True
End Sub


Jeff

Private Sub Worksheet_Change(ByVal Target As Range)
MsgBox "C"
End Sub

"needyourhelp" wrote:

I would like to pass program control from a VBA macro to a user on a
particular sheet, let the user do whatever, then return control to VBA
and
pick up where I left off with all my VBA variables/pointers intact.

I think the answer is "Design it a different way", but I thought I'd ask
since I would prefer to the let the user process the data in the already
complex spreadsheet, instead of having to dupe all the formulas in vba.


thanks,

tim



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default How to Pass Control from VBA to user and return

Can you just break your code into 2 subs; the "before" and "after", and use
Public variables to store the necessary values?

"needyourhelp" wrote:

I would like to pass program control from a VBA macro to a user on a
particular sheet, let the user do whatever, then return control to VBA and
pick up where I left off with all my VBA variables/pointers intact.

I think the answer is "Design it a different way", but I thought I'd ask
since I would prefer to the let the user process the data in the already
complex spreadsheet, instead of having to dupe all the formulas in vba.


thanks,

tim

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
Pass control back to Excel window [email protected] Excel Worksheet Functions 1 December 29th 06 07:24 PM
Pass variable from user form to macro r wilcox Excel Programming 1 May 23rd 05 07:27 PM
User created control for use in Excel? Sandra[_5_] Excel Programming 1 February 9th 05 12:42 PM
Using Multiple User Forms to pass info from one to the other Neal Excel Programming 2 December 14th 04 12:29 AM
User/pass prompting code count Excel Programming 0 July 10th 04 12:41 AM


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