LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 256
Default Pls explain this VBA oddity

As to why it's there twice, imagine you have a segment of code that
you're editing in a separate window prior to pasting it into the main
module. You started in the main module but decided to separate it out
so as not to confuse what's where.

The first portion of this code segment contains the following
assignment:

foobar = 1234

You paste that into your separate window, finish your editing, and
paste it back to your main module. However, the code you highlight to
replace excludes the original foobar=1234. Therefore you get it
twice.

This happens pretty often for people copying code from newsgroups,
with things such as Option statements.


On Dec 18, 11:47 am, wrote:
On Dec 18, 12:13 am, carlo wrote:

if the Variable is declared inside the sub the scope should be
inside it as well. I don't know if you can get access to that
variable, but i'd say 99% no.


Right. Immediately after posting my "fishing" speculation, I realized
that the only instances (that I know of) where a procedure has access
to variables declared in the caller are languages where procedures can
be defined within in the scope of other procedures (e.g. Algol-W).

Oh well, I just trying to give the programmer the benefit of the
doubt, stretching to find some meaning for the code. I'm sure now
that there is none.

Another thing what makes me think it is dummycode is the name of the
variable "foobar"


Sorry, the choice of the name was mine, just for posting purposes. It
bears no relationship to the real name. I had already searched the
Object Browser to no avail.

Thanks again. I think your comments have put the final nail in the
coffin.


 
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
COUNTIF oddity Phil C Excel Worksheet Functions 1 May 30th 07 09:19 AM
An oddity if not a bug Harlan Grove Excel Worksheet Functions 21 July 17th 06 05:36 PM
Oddity with HSI Mike[_51_] Excel Programming 2 July 14th 06 06:33 PM
Chart oddity Ron P Charts and Charting in Excel 2 February 16th 06 03:05 PM
Another Excel oddity Steve Excel Discussion (Misc queries) 5 January 5th 05 08:50 PM


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