Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default passing variable

i need to pass a variable (comname$) from worksheet code to an application
in a module.

i.e

Private Sub Worksheet_Activate()
comname$ = "Comboboxone"
Application.Run "test.xls'!loadcombo"
End Sub

in module 1...

Sub clearcombo()
ActiveSheet.com$.Clear 'where com$ is name of combobox
End Sub

Help will be appreciated.

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default passing variable

And this ClearCombo routine lives in a general module in the same workbook?

If yes, then you don't need to use Application.run.

I'd use this behind the worksheet

Option Explicit
Private Sub Worksheet_Activate()
Call ClearCombo(WhichCombo:=Me.ComboBox1)
End Sub

And this in a General module:
Option Explicit
Sub ClearCombo(WhichCombo As msforms.ComboBox)
WhichCombo.ListFillRange = "" 'just in case
WhichCombo.Clear
End Sub


sunilpatel wrote:

i need to pass a variable (comname$) from worksheet code to an application
in a module.

i.e

Private Sub Worksheet_Activate()
comname$ = "Comboboxone"
Application.Run "test.xls'!loadcombo"
End Sub

in module 1...

Sub clearcombo()
ActiveSheet.com$.Clear 'where com$ is name of combobox
End Sub

Help will be appreciated.

Thanks


--

Dave Peterson
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 a Variable to a Macro IAM Excel Programming 4 December 9th 08 02:53 PM
Passing a variable to a GoTo Planner[_3_] Excel Programming 2 April 14th 08 08:44 PM
Passing variable to Access Job Excel Programming 4 July 6th 05 03:52 PM
Passing variable to VarType of other Variable ExcelMonkey[_190_] Excel Programming 3 February 22nd 05 01:38 PM
Passing variable from one sub to another Medemper Excel Programming 0 February 26th 04 10:23 PM


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