LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default Variables

I think I must be stupid, as I have read lots of information and am not
getting the point.

I am very used to declaring variables as follows:

sub whatever()

dim strSht4Name As String

strSht4Name = "nameofsheet4"

end sub

I have 2 questions:

1) Can I combine the 2 rows i.e.
dim strSht4Name As String = "nameofsheet4"

2) As I now also better understand going "public" I would like to do the
following:
Public strSht4Name As String
strSht4Name = "nameofsheet4"

But am informed by excel that the second line where I pass a value to the
variable is not correct outside a sub. Is this correct or am I doing
something wrong?

Thanks for the help and advice (It would be good if this got better coverage
in the books us lesser mortals purchase)

Richard
 
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
Sum if 2 variables ksel Excel Discussion (Misc queries) 6 June 18th 09 09:45 AM
Not at all clear on use of variables and/or object variables JMay-Rke Excel Discussion (Misc queries) 11 July 4th 08 06:36 PM
Storing variables in a macro and using those variables to performcalculations. [email protected] Excel Programming 3 December 10th 07 04:13 PM
Variables in VBA Sloth Excel Programming 3 December 29th 05 07:23 PM
SUM IF and two variables Leigh Ann Excel Worksheet Functions 6 May 25th 05 03:24 AM


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