Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Variable in event handles can't be used in module??

This must be simple but I was unable to find how to do.

In the event handler I use a variable

-----------------------------------------------------
Option Explicit
Public var1 As String
Dim status As String
-----------------------------------------------------
Private Sub Worksheet_BeforerightClick(ByVal Target _
As Excel.Range, Cancel As Boolean)

If Target.Column < 22 Then Exit Sub
If Target.row < 5 Then Exit Sub

If ActiveCell.Value = "" Then
ActiveCell.Value = "1"
status = "1"
End If
Var1 = Worksheets("maandag").Cells(Target.row, 28)
Check_status
End Sub

In the module it goes like:

Sub Check_status()
MsgBox var1
End Sub

Problem is that the var1 is not present in the module, can someone help me...

Thanks in advance

Jan Grinwis
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Variable in event handles can't be used in module??

Assume that Var1 is declared in the sheet module for sheet1 (codename
sheet1)

Sub Check_status()
MsgBox sheet1.var1
End Sub

--
Regards,
Tom Ogilvy

"Jan Grinwis" wrote in message
om...
This must be simple but I was unable to find how to do.

In the event handler I use a variable

-----------------------------------------------------
Option Explicit
Public var1 As String
Dim status As String
-----------------------------------------------------
Private Sub Worksheet_BeforerightClick(ByVal Target _
As Excel.Range, Cancel As Boolean)

If Target.Column < 22 Then Exit Sub
If Target.row < 5 Then Exit Sub

If ActiveCell.Value = "" Then
ActiveCell.Value = "1"
status = "1"
End If
Var1 = Worksheets("maandag").Cells(Target.row, 28)
Check_status
End Sub

In the module it goes like:

Sub Check_status()
MsgBox var1
End Sub

Problem is that the var1 is not present in the module, can someone help

me...

Thanks in advance

Jan Grinwis



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
Where?Worksheet code module or Worksheet_SelectionChange event han Kenzie Excel Worksheet Functions 4 January 30th 06 09:41 PM
Handling of event raised in other class module VbaNew Excel Programming 1 January 10th 05 12:42 PM
Run module ON OPEN event?? MG Excel Programming 1 January 9th 04 12:31 AM
Which event puts *white* handles around a chart? Dan[_28_] Excel Programming 1 November 21st 03 09:49 PM
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 11:07 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"