Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default How public is public?

I am writing a procedure that I want to either access from the macro manager
in the excel interface (without a parameter) or call from another procedure
and pass a parameter. My first inclination was -

Sub ColsHide(Optional CH_Row As Integer = 1)

which would set the CH_Row variable to 1 if not passed as a parameter.
However this approach makes the procedure invisible to the macro manager.

Next approach was to set a public variable in the calling program -

Public CH_Row As Integer

Sub ColsHideKen()

CH_Row = 1
ColsHide

End Sub

but the following code in ColsHide

If VarType(CH_Row) = vbNull Then
CH_Row = Application.InputBox(Prompt:="Enter row number to test",
Title:="COLS HIDE", Default:=1, Type:=1)


Else
' CH_Row already set publicly

End If

works out that CH_Row exists but the following method cannot interpret it as
a valid numeric input

Cells(CH_Row, CH_Col + 1).Select


TIA
--
Ken
"Using Dbase dialects since 82"
"Started with Visicalc in the same year"
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
How public is public? K_Macd Excel Programming 2 August 7th 09 01:37 AM
Public variable (or Public Const?) Brettjg Excel Programming 14 April 23rd 09 11:30 PM
Public variable (or Public Const?) Tim Williams[_2_] Excel Programming 0 April 23rd 09 06:33 AM
Public? Chip Pearson Excel Programming 0 January 17th 07 11:28 PM
Public Sub Help No Name Excel Programming 2 May 18th 04 11:09 PM


All times are GMT +1. The time now is 06:41 PM.

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"