Yes, I think I remember you posting code like that in the past... I didn't
find it easy to read either.<g>
Just for accuracy sake, the VB editor will not allow you to space the colon
away from the statement in front of it like you show.... the editor will
move the colon so that it is adjacent to the statement in front of it which
is one of the things that make these kinds of code lines hard to read in my
opinion.
--
Rick (MVP - Excel)
"Dave Peterson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Actually, when the code is simple, I do use multiple logical lines on a
> single
> physical line:
>
> Select case something
> case is = aaa : somethingelse = 5
> case is = bbb : somethingelse = 6
> case is = ccc : somethingelse = 7
> case is = ddd : somethingelse = 8
> End select
>
> But, again, it's a personal preference.
>
> Rick Rothstein wrote:
>>
>> It is not just you... I find that hard to read also. Plus, you are not
>> really saving anything significant be doing it this way either... it is
>> still two separate statements.
>>
>> --
>> Rick (MVP - Excel)
>>
>> "Dave Peterson" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > You can put two logical lines on a single physical line like this:
>> >
>> > Dim myConst as Long: myConst = 12
>> >
>> > Personally, I would find this more difficult to read. (Maybe it's just
>> > me.)
>> >
>> > Pawan wrote:
>> >>
>> >> This is correct. Here by 0 I want to say any value. Means suppose if I
>> >> want
>> >> to assign default value of 2 (or any other value) to my variable, then
>> >> is
>> >> there any way to assign it when we declare the variable? We can assign
>> >> it
>> >> in
>> >> separate statement like cnt = 2, but I want to assign it I at the same
>> >> time
>> >> we declare the variable.
>> >>
>> >> Thank You
>> >>
>> >> "Mike H" wrote:
>> >>
>> >> > Hi,
>> >> >
>> >> > When you dim your variable by default it is set as nothing which for
>> >> > an
>> >> > integer variable is the same as zero which can be demonstrated with
>> >> > this bit
>> >> > of code
>> >> >
>> >> > Dim cnt As Integer
>> >> > MsgBox cnt + 10
>> >> >
>> >> > If you try this you will find the message box displays 10 so cnt
>> >> > was
>> >> > zero
>> >> >
>> >> > Mike
>> >> >
>> >> > "Pawan" wrote:
>> >> >
>> >> > > Hi
>> >> > >
>> >> > > I have few variables which have default value of 0. This value
>> >> > > will
>> >> > > change
>> >> > > during macro execution. Is there any way to declare 0 value to
>> >> > > these
>> >> > > variables while defining those at the beginning of the code? Means
>> >> > > when we
>> >> > > define variable as Dim cnt as integer, can I define 0 value there
>> >> > > itself?
>> >> > >
>> >> > > Thank You
>> >> > >
>> >> > >
>> >
>> > --
>> >
>> > Dave Peterson
>
> --
>
> Dave Peterson
|