LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default I am always getting these errors and I never understand why.

Here is some code that I'm working on. It's choking on the second loop
statement. I'm getting the Run-time error '1004': Application-defined or
object-defined error. I get this error message all the time and it's driving
me nuts. After some fiddling I'm able to work around it but I can't get past
it this time. Here's the code:

Dim DateValidation As Range
Dim SingleDate As Range
Dim ManningDate As Range
Dim BlankCounter As Integer

Set DateValidation = Application.InputBox(Prompt:="Please select the week(s)
to validate on the Yearly Manning sheet.", _
Title:="Select week(s) to validate", Default:=Selection.Address, Type:=8)
On Error GoTo 0

If DateValidation Is Nothing Then Exit Sub

For Each SingleDate In DateValidation
If Not IsDate(SingleDate) Then
MsgBox "Please select only the week ending dates that you wish
to validate", vbInformation, "Oops, wrong spot"
Exit Sub
End If
Next SingleDate

For Each SingleDate In Sheets("Yearly Manning").Range(DateValidation.Address)

BlankCounter = 0

For Each ManningDate In Sheets("Yearly
Manning").Range(SingleDate.EntireColumn)

If ManningDate.Value = "" Then
BlankCounter = BlankCounter + 1
Else
BlankCounter = 0
End If

If BlankCounter 15 Then
Exit For
Else
'''Do more stuff here
End If

Next ManningDate

Next SingleDate

The error message is coming up on the second loop statement: For Each
ManningDate In Sheets("Yearly Manning").Range(SingleDate.EntireColumn)

What is wrong with using the entire column as my range? As you can I have a
BlankCounter to get out of the loop once I go through enough blank rows.
 
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
Gap or something I cannot understand MFS Excel Discussion (Misc queries) 1 August 26th 09 12:13 AM
not understand [email protected] New Users to Excel 1 February 24th 08 02:18 PM
Excel Throwing Circular Errors When No Errors Exist MDW Excel Worksheet Functions 1 August 10th 06 02:15 PM
Unresolved Errors in IF Statements - Errors do not show in results Markthepain Excel Worksheet Functions 2 December 3rd 04 08:49 AM
<> Scooterdog Excel Worksheet Functions 1 November 8th 04 07:56 AM


All times are GMT +1. The time now is 11:09 AM.

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"