Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default What wrong with the coding?

Does anyone have any suggestions on what wrong is the coding?
If specific cell contains the text "ON", then keep processing the coding,
else skip it and next.
Does anyone have any suggestions on how to fix the coding at Error line?
Thanks in advance for any suggestions
Eric

Sub aUpdating()

Dim lngRow As Long, ws As Worksheet, wsDate As Worksheet

Set wsDate = Sheets("Date")
For lngRow = 2 To wsDate.Range("E1").Value

If wsDate.Range("F" & IngRow).Value = "ON" Then ' Error on this line

'Do something

End If
Next

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default What wrong with the coding?

You have declare a variable named "lngRow" (starts with a lower case
"L") and you are using in your conditional "IngRow" (starts with an
upper case "I").

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com



On Mon, 19 Apr 2010 09:31:01 -0700, Eric
wrote:

Sub aUpdating()

Dim lngRow As Long, ws As Worksheet, wsDate As Worksheet

Set wsDate = Sheets("Date")
For lngRow = 2 To wsDate.Range("E1").Value

If wsDate.Range("F" & IngRow).Value = "ON" Then ' Error on this line

'Do something

End If
Next

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 905
Default What wrong with the coding?

"Chip Pearson" wrote:
You have declare a variable named "lngRow"
(starts with a lower case "L") and you are
using in your conditional "IngRow" (starts
with an upper case "I").


Mistakes like that can be avoided by putting the statement Option Explicit
at the start of the module. It requires that all variables be declared
explicitly.


----- original message -----

"Chip Pearson" wrote in message
...
You have declare a variable named "lngRow" (starts with a lower case
"L") and you are using in your conditional "IngRow" (starts with an
upper case "I").

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com



On Mon, 19 Apr 2010 09:31:01 -0700, Eric
wrote:

Sub aUpdating()

Dim lngRow As Long, ws As Worksheet, wsDate As Worksheet

Set wsDate = Sheets("Date")
For lngRow = 2 To wsDate.Range("E1").Value

If wsDate.Range("F" & IngRow).Value = "ON" Then ' Error on this line

'Do something

End If
Next


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default What wrong with the coding?

Add OPTION EXPLICIT before your sub and try to compile the code. You'll see
where the problem is.
--
HTH,

Barb Reinhardt



"Eric" wrote:

Does anyone have any suggestions on what wrong is the coding?
If specific cell contains the text "ON", then keep processing the coding,
else skip it and next.
Does anyone have any suggestions on how to fix the coding at Error line?
Thanks in advance for any suggestions
Eric

Sub aUpdating()

Dim lngRow As Long, ws As Worksheet, wsDate As Worksheet

Set wsDate = Sheets("Date")
For lngRow = 2 To wsDate.Range("E1").Value

If wsDate.Range("F" & IngRow).Value = "ON" Then ' Error on this line

'Do something

End If
Next

End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default What wrong with the coding?

And then, after you do as Barb has suggested and you see the benefit of
using Option Explicit, click Tools/Options on the VB Editor's menu bar,
select the Editor tab on the dialog box that appears and put a check mark in
the CheckBox labeled "Require Variable Declaration"... doing that will
automatically place the Option Explicit statement in all **new** code
windows that get called up (not only in your current project, but in all
projects you work on afterwards). Note, I said "new" windows... the Option
Explicit statement will not be added to any existing windows with code in
them, only to new window called up after the option is evoked. Oh, and I
would also suggest you uncheck the CheckBox labeled "Auto Syntax Check" if
you haven't already done so. Incorrect syntax will still be highlighted for
you, but you won't be bothered by dialog boxes insisting you fix the code
line right then and there.

--
Rick (MVP - Excel)



"Barb Reinhardt" wrote in message
...
Add OPTION EXPLICIT before your sub and try to compile the code. You'll
see
where the problem is.
--
HTH,

Barb Reinhardt



"Eric" wrote:

Does anyone have any suggestions on what wrong is the coding?
If specific cell contains the text "ON", then keep processing the coding,
else skip it and next.
Does anyone have any suggestions on how to fix the coding at Error line?
Thanks in advance for any suggestions
Eric

Sub aUpdating()

Dim lngRow As Long, ws As Worksheet, wsDate As Worksheet

Set wsDate = Sheets("Date")
For lngRow = 2 To wsDate.Range("E1").Value

If wsDate.Range("F" & IngRow).Value = "ON" Then ' Error on this line

'Do something

End If
Next

End Sub


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
What do I do wrong [Excuses pushing the wrong key combination earlier] Vsn Excel Programming 7 November 8th 09 09:12 PM
Insert Calculated Field (wrong Qty*Price = wrong Amount) Edmund Excel Discussion (Misc queries) 8 October 4th 07 12:13 PM
"=ROW()-1" type of coding doesn't appear in a filter / is there coding that does? StargateFan[_3_] Excel Programming 10 October 6th 05 01:18 PM
Implant macro coding into ASP coding Sam yong Excel Programming 5 September 15th 05 10:37 AM
What 's wrong with the coding? -- about using outlook to send attachment in excel Terry Excel Programming 1 February 5th 04 10:31 PM


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