Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 391
Default VBA line of code executes in Immediate Window but not in Code Window

2003/2007

Using 2007

Dim StartSearch as Long (Value preceeding line below is 13)
Dim FormulaStr as String (Value preceeding/after line below is 123]
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Application.Calculation = xlAutomatic


StartSearch = IIf(InStr(StartSearch, FormulaStr, "'!") = InStr(StartSearch, FormulaStr, "'"), _
InStr(StartSearch, FormulaStr, "'!") + 2, InStr(StartSearch, FormulaStr, "'") + 1)

In the Code Window, this line does not change the next StartSearch value from 13 to 46.
Also, no error message is displayed.

But if I copy/paste/execute the same line in the Immediate Window StartSearch chages
from 13 to 46 as it should.

What am I missing? or is there a Bug in 2007?

TIA EagleOne
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 391
Default VBA line of code executes in Immediate Window but not in Code Window

There may well be a bug in Excel xl 2007

Just on a hunch, I Copy/Pasted a second line of the same code under the first line and it worked.
If I delete either the first or second line neither works?

Also, I retyped the line of VBA code in case there was "garbage"; this did not work

This is the first time I can remember having to Code two lines of VBA Code to get one to work.

Any thoughts?

EagleOne

wrote:

2003/2007

Using 2007

Dim StartSearch as Long (Value preceeding line below is 13)
Dim FormulaStr as String (Value preceeding/after line below is 123]
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Application.Calculation = xlAutomatic


StartSearch = IIf(InStr(StartSearch, FormulaStr, "'!") = InStr(StartSearch, FormulaStr, "'"), _
InStr(StartSearch, FormulaStr, "'!") + 2, InStr(StartSearch, FormulaStr, "'") + 1)

In the Code Window, this line does not change the next StartSearch value from 13 to 46.
Also, no error message is displayed.

But if I copy/paste/execute the same line in the Immediate Window StartSearch chages
from 13 to 46 as it should.

What am I missing? or is there a Bug in 2007?

TIA EagleOne

  #3   Report Post  
Posted to microsoft.public.excel.misc
jaf jaf is offline
external usenet poster
 
Posts: 300
Default VBA line of code executes in Immediate Window but not in Code Window

Hi,
Do you have a "sub..." /End sub?

--
John
johnf202 at hot mail dot com


wrote in message
...
2003/2007

Using 2007

Dim StartSearch as Long (Value preceeding line below is 13)
Dim FormulaStr as String (Value preceeding/after line below is 123]
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Application.Calculation = xlAutomatic


StartSearch = IIf(InStr(StartSearch, FormulaStr, "'!") =
InStr(StartSearch, FormulaStr, "'"), _
InStr(StartSearch, FormulaStr, "'!") + 2, InStr(StartSearch, FormulaStr,
"'") + 1)

In the Code Window, this line does not change the next StartSearch value
from 13 to 46.
Also, no error message is displayed.

But if I copy/paste/execute the same line in the Immediate Window
StartSearch chages
from 13 to 46 as it should.

What am I missing? or is there a Bug in 2007?

TIA EagleOne



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
Docking Project Explorer, Properties window and Code window in VBE jayray Setting up and Configuration of Excel 2 March 27th 07 04:42 PM
The window opens in a smaller window not full sized window. Rachael Excel Discussion (Misc queries) 0 November 7th 06 09:04 PM
In Excel - how to delete new window created from window on tool ba Doug Excel Worksheet Functions 1 April 20th 06 09:22 PM
How do I undo the Excel, Window Menu, New Window command OLDFANG Excel Discussion (Misc queries) 2 March 17th 06 05:31 PM
IDE - 2003 - Cursor in Code window Jim May Excel Discussion (Misc queries) 1 July 24th 05 04:32 PM


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