Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Passing a variable from sheet code to a module

Is it possible to pass a variable from a worksheet_calculate macro to a macro
in a module?

I'm familiar with public variables and calling functions, but these don't
enable me to do what I need.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Passing a variable from sheet code to a module

Put a variable declaration as public before the first procedure in a standard
VBA module (NOT a worksheet module OR a form module).
Ex: PUBLIC varTest as variant
This variable is now available to ALL MODULEs including worksheet modules
--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"Robert Pearson" wrote:

Is it possible to pass a variable from a worksheet_calculate macro to a macro
in a module?

I'm familiar with public variables and calling functions, but these don't
enable me to do what I need.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Passing a variable from sheet code to a module

'Sheet Module...
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Sludge As Double
Sludge = Me.Range("A1").Value
Call MacroInModule(Sludge)
End Sub

'Standard/General Module...
Sub MacroInModule(ByRef PassedValue As Double)
'do something using PassedValue
End Sub
--
Jim Cone
Portland, Oregon USA




"Robert Pearson" <Robert
wrote in message ...
Is it possible to pass a variable from a worksheet_calculate macro to a macro
in a module?

I'm familiar with public variables and calling functions, but these don't
enable me to do what I need.
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
Passing Public Variable into Sheet Sub Functions Lance Hoffmeyer[_3_] Excel Programming 3 January 11th 08 11:38 PM
Code to change code in a sheet and workbook module Otto Moehrbach Excel Programming 11 November 11th 07 07:20 PM
passing a variable from sheet to form to another sheet anny Excel Programming 2 May 7th 06 11:45 PM
Passing Variable from Sheet to Userform gti_jobert[_40_] Excel Programming 1 February 27th 06 09:38 AM
Variable from a sheet module in a class module in XL XP hglamy[_2_] Excel Programming 2 October 14th 03 05:48 PM


All times are GMT +1. The time now is 09:28 AM.

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"