Evaluate problem

This is an excerpt from some working code:
With Workbooks("stations.xls").Sheets("Sheet1")
    Here = ActiveWorkbook.Name: .Activate ' See what is going on
    StationRow = Application.Match(EndStation, .Range("$A$1:$A$298"), 0)
    s = .Cells(StationRow, OfficeHoursCol).Formula
    s = Evaluate(GetSub(s, "^=HYPERLINK.(.*), .Hours..$", "$1"))
    TxURL s

When I comment the "Here = ..." line, the "s = Evaluate..." does not
work as intended.
When "Sheet1" is active "A40" is a reference to a cell in "Sheet1"; when
inactive, it is a reference to whatever other sheet happens to be
active.

As it happens, the fix was easy. I commented the two "s =" lines, and
inserted
    s = "http://www.journeyplanner.org/imr/XSLT_SOI_REQUEST?" & _
        "language=en&itdLPxx_agent=ticketOffice&type=stop&id=" & _
        .Cells(StationRow, JPcodesCol)

I can probably do better when I think about it. At the moment, I am
happy to have a fix.

I would appreciate light on similar problems. I suspect it is a problem,
already known to gurus here. I have been assuming that the sequence
Here = ActiveWorkbook.Name: .Activate ' See what is going on
<some code>
Windows(Here).Activate

is equivalent to
<some code>
-- 
Walter Briscoe
0
Walter
5/31/2010 1:56:06 PM
excel.programming 6508 articles. 2 followers. Follow

1 Replies
895 Views

Similar Articles

[PageSpeed] 26

"Walter Briscoe" <wbriscoe@nospam.demon.co.uk> je napisao u poruci 
interesnoj grupi:CWm+wKr2$7AMFwa5@freenetname.co.uk...
> This is an excerpt from some working code:
> With Workbooks("stations.xls").Sheets("Sheet1")
>    Here = ActiveWorkbook.Name: .Activate ' See what is going on
>
> When I comment the "Here = ..." line, the "s = Evaluate..." does not
> work as intended.

after 'name' there is a colon ':', is it intentional?
colon ':' is a command separattor, so on that line you have actualy two 
commands, '.activate' being the second
it is a bad practice, since program flow is not so clear 


0
sali
5/31/2010 2:37:22 PM
Reply:

Similar Artilces:

Data Form Problem
I have a fairly simple table, with about 7 columns of data which I have created for a co-worker. Most rows contain a single line of data, but the last one of the fields uses "wrap text" and may have as many as 7-10 lines in that field. I am trying to make it so she can use the Data Form method for data input. I am able to get the Form to be created, but it says I only have one record . . . when very clearly there are many more records. Does anyone know why this might be? I thought it might be because of the "wrap text" in the one column . . . and so I tried c...

Macro problem #13
Dear Members Hello, my name is Peter Taylor, from Swan Hill, Australia. Which leads me to my next question. I am trying to create a simple macro that when this macro is selected (or even better automatically done when Excel is loaded) of highlighting a cell (from a range say of A1:A100) that has the current date (6/11/2004). I have a long column of dates eg: 5/11/2004 Friday 6/11/2004 Saturday 7/11/2004 Sunday 8/11/2004 Monday 9/11/2004 Tuesday 10/11/2004 Wednesday 11/11/2004 Thursday 12/11/2004 Friday 13/11/2004 Saturday 14/11/2004 Sunday So as each new day comes around t...

Division problem
I am trying to make a simple sheet to track my performance at work. We get bonuses based on productivity and I entered the equation =b/c*d and if there is no data in those boxes, I get the #DIV/0! error. These cells will stay empty until each work day is over. Sometimes, a row will stay empty because I have not run a machine to put data there. How do I avoid the #DIV/0! error when cells/rows are empty of data or have a zero value? I have three rows per work day and some days I run one machine, some days I run two and every now and then, I run three. I need to be able to leave rows blank...

problem with Data|Text to Columns
I wrote a while back and was possibly not clear - I do a lot of data import and clean up - on this new computer, the subject topic, which I call data parsing, does not work correctly. I have to divide the columns with one extra space, which I never had to do before. I hate to think of uninstalling excel, but if that's what it takes . . . Any advice would be gratefully appreciated. Happy New Year -- Regards, P D Sterling New York, Texas & Texas, New York P D Sterling" <pdsterling@hotmail.com> wrote in message news:%23sslSLUTIHA.4656@TK2MSFTNGP03.phx.gbl... > call...

Advanced Filter problem
I have a series of formulas bringing dates into cells A1 to A10. Th formulas are simple = another cell formulas. I am trying to Advanced filter the dates - copy them to anothe location and also display unique records only. This should display list of all the dates in Cells A1 to A10, removing duplicates of an dates listed. When I click OK after setting up the Advanced Filter as above I get th error - The extract range has a missing or illegal field name. Can anyone help. I know that if I simply type the dates and run the filter it work fine, but this is no good for me. Rgds Okane -- o...

Problems setting up a forwarding address
Hi, I''ve been having a problem setting up email forwarding within Active Directory. I've been asked to setup forwarding for some users to external email addresses. I've done this ok in the past. Go to the 'Exchange General' tab of the user's AD properties. Click on 'Delivery options' and then click on Modify under forwarding address. On the newly opened window, click on object types and ensure 'contacts' is checked. Only this time I can't, the only object types available are 'users' and 'other object'. 'Conta...

Excel problem #12
I am working on an Excel file for work and thought that maybe you could help me out with the formulas. I initially thought that a combination of an If / sum function would work but I am having a problems. He is the situation: I have one Excel sheet with a couple of workbooks. I have one workbook that has about 8 columns and 25 rows (the number of row could change on any given day) one of the columns has different plants listed (coded by a number). What I want is to have Excel look up the plant I tell it to, and then sum the cost savings (in a different column) by plant. I then want Excel...

Downloadable evaluation version of Outlook 2003
does anyone know if it possible to get a downloadable version? Thanks.....Sly Sly wrote: > does anyone know if it possible to get a downloadable > version? > > Thanks.....Sly No. Not full Outlook, only Outlook Express is downloadable along with IE... >-----Original Message----- >does anyone know if it possible to get a downloadable >version? > >Thanks.....Sly >. > ...

Evaluating text as formulae
Is it possible to refer to text in a cell as though it were a formula, ie execute it instead of displaying it? Eg if the result of your formula was "A1 + B2", to actually add A1 and B2 and display the result? Thanks Nigel Like concatenating text? =concatenate(a1," + ",b2) or =concatenate(a1,b2) =concatenate(a1," ",b2) "Nigel Ramsden" wrote: > Is it possible to refer to text in a cell as though it were a formula, ie > execute it instead of displaying it? Eg if the result of your formula was > "A1 + B2", to actually add A1 and...

Very odd build problem
As part of my BSPs build process I am checking whether some components are built within a batch file, if these files are build the batch file exits and the build continues. If the components are not built then the batch file calls into a 3rd party build system and builds these components. The problem that I am finding is that during the build (lets say initialiated using blddemo -qbsp) the variable '_winceosver' is lower case, but if I build myself from the command prompt (for example openned using Build > Open Build Directory In Build Window) then the variable is in ...

Date Serial Problem
I have a querry in which I am using the Date Serial in the querry criteria as follows Between DateSerial([Enter Year:],[Enter Month:],1) And DateSerial([Enter Year:],[Enter Month:]+1,0) the result i get is for a a perticular month in a year. What I want is: 1. if i want to get the results between june to november 2009. how can i do it? 2. If i want to get the restult of 2008 only e.g. from 01 Jan 2008 (or any year) upto 31 December 2008. This should give result only for 1 year only. not by months like from june 2008 to june 2009 Please help me fix this querry ...

OWA Logoff problem
I just implemented Exchange Server 2003 OWA to access email over the internet. One issue I have is on a Win 98 laptop using IE 5. When I click the Log Off button, a screen comes up with a button to close the brower. The browser closes ok, but my login credentials are not deleted until like 10 minutes after I log off. Until that point, I can just pull up the URL, and OWA comes up authenticated!! After approximately 10 minutes, a little window flashes on the screen (flashes too quick to even read it). After that window flashes, OWA requires authentication. My XP clients with IE 6 log off i...

Have you evaluated...
Has anyone evaluated Celerant Command Retail or Tomax Retail.net POS solutions? How are they compared to RMS in terms of features and prices? ...

Excel 2000 hyperlink problem
I have a spreadsheet of personnel from other offices that has the usual items: Name, Address, City..., Phone, emails, etc. For some reason in the middle of the worksheet, every cell has an email hyperlink, and not necessarily for the associated person. It's in cells that are not even email addresses. If I try to remove the hyperlink, Excel hangs- up and I have to task-manager out of it. Some of the items have been copied and pasted from another workbook, but there were no macros involved, if that means anything to you. So my question is, how do I either remove the hyperlinks fro...

Problem with autoplay
Hi, I am running Windows XP SP3 Home Edition which is fully patched. Lately, I have discovered that when I put a DVD/CD in either a DVD burner or DVD ROM, I see the "Safely Remove Hardware" message in the sys tray. When I try to run task manager it gives me only a blank dialog box. I cannot start any of my applications ( same problem, blank dialog boxes). Rebooting the system clears up the problem but I can't insert any DVD or CD without the problem reoccuring. Is Autoplay corrupted? Any help would be greatly appreciated. Thanks, -Rich > I am runn...

Problem with investment vs cash balances in Money 2004
I am having a terrible problem with balancing the cash side of an investment account. I have searched this newsgroup and have already tried the various "file repair" options (i.e., msmoney -s, quick and standard file repair, and salvage). I have even exported the account and reimported it. However, none of these attempts have fixed the problem (or even identified that anything is wrong with the file). Here is what I am experiencing: I use a brokerage account as my checking account. I download transactions periodically and reconcile the cash side monthly against my paper...

save problem in Excel
Dea all , i got the following problems on excel : 1. it can't show "read only" when other people want to open my excelsheet at the same time. and it cause "sharing violent" when they want to save the sheet that I am currently open. so , how to fix it ? 2. when some user open the excelsheet and want to save/save as something , excel displayed "save not complete" ... (some kind of not allow to save) why this situation happened ? and how to fix it ? Thank you so much for your help indeed M&M; Try via the Menu, Tools | Share workbook and see if...

Brightness problem :///
Hello i followed google link up to here while i was searching for the answer to my problem....so here it is: I got: Win XP2 ATI Radeon HD 2600/3600 LG Monitor updated drivers new installed win Brightness 100% & Contrast 100% (on monitor) and its still DARK i used to have some win integrated software that sets brightness up to about 150% but after new win installation i lost it.... So can anyone help me light up my monitor a bit?? Any software that can set brightness more than 100% of my monitor? Cause every software i used it gets already on max..on the top and its the sa...

Problem with my Dlookup
I’m trying to get a simple Dlookup working and I seem to be struggling with it. I have values that I pass to a query, using VBA, and populate TextBoxes on a report. One TextBox is named ‘CUST’ for Customer. When CUST is populated, I’d like to see a rate (this is fixed for each customer) in my report. This is what I have now: =DLookUp("Rate","Customers","Customer = " & [CUST]) Rate is the Rate that I want to lookup. Customers is the name of the table. CUST is the TextBox on the report. What am I doing wrong? Thanks! Ryan-- -- R...

EDATE Problem
It was working fine yesterday and I come in today to update certain things and it will not work. When I change the date in the cell that would normally effect the formulated cell, the formulated cell value does not change. If I select the formulated cell and hit F2, enter, it will change but it used to do it automatically. I have the the analysis toolpak checked and there have not been any changes to the system. -- pknivens ------------------------------------------------------------------------ pknivens's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=27675...

Help! Weird Outlook 2003 problem
I recently had to re-install Outlook 2003 (clean install). It previously worked OK (installed on top of OL 2002). I have a weird problem. I set-up two e-mail accounts - one POP3 and one HTTP (Hotmail). Both accounts appeared to set-up OK. The POP3 account tests perfectly. But my folders do not synchronise when I start Outlook (they used to) and *nothing* happens when I select "Send/Receive". It's as though I haven't set-up any e-mail accounts. *But* I can get my e-mail if I manually download headers (from the Send/Receive menu), mark each message for download and then &quo...

problem with an Excel chart
I'm trying to create a basic line chart in Excel. There are 6 series and each series has 5,000 data points. The resulting curves are short, i.e., they don't expand when I resize the chart. I also get a warning about the series size limit being 32,000 points. I have a total of 30,000 points among all 6 series. In the Y-values box in the chart wizard, for example, I'm defining the series in column B of tab A as A!$B2:$B5001, with the series name in cell B1. The scale for the x-axis only has options for number of categories between tick marks and number of categories be...

Problems with Mailforwarding
Recently I installed Exchange Server 2003 on Windoows Server 2003. Usually it is possible to use the server as an mailserver, too, if I correctly understand it. I get also messages about the mailserver sending to address exists there, but it is no possible to send messages over the server. After several hours I ever get a status message that the message will retard for a while but I should not send the message again. Unfortunatally I notice, that the message I send never reach the recipient. What reason could it be, that the message will not forward ? Michael Michael Kauert wrote: ...

Encoding problem #3
I'm trying to do a transform (Using XmlTransform class in c#) and in the Transform I'm specifying the the output xsl below: <xsl:output method="xml" encoding="UTF-8" indent="no"/> the resulting xml ends up with the following declaration: <?xml version="1.0" encoding="utf-16"?> changing the encoding to utf-16, is there something I'm doing wrong? Is it possible to make the resulting xml declaration omit the encoding all together? thanks Demon News wrote: > I'm trying to do a transform (Using XmlTransfo...

onenote 2007 problem
hi from brazil. i have a hard problem with onenote. i can start and use it, but when i close the program the process continues endless, days and days on. it was working correctly, but two week ago the error started. i've tried google it, but it was useless. tried to wait days with the notebook turned on and the process running... useless too. tried to delete the onenote cache... didn't work too. tried to unistall and install again... the problem remains. besides the endless process, that i can finish from process manager ( but it once i use onenote and close, it comes b...