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: 360
Default function for checking for an odd number

This code works but the division should always give an even number. I'm
trying to error check for an accidental odd number of rows in the
irwo(service group column). The code should continue but give an error
message. There are 2 lines in the code that have division and they should
both be even quotients. Should I put the resume Next on both lines for it to
error check for both lines? The other question is if both numbers are
integers when they divide what would be the function to get it to throw an
error if it is not an even division?

tia,

-----section of code---------

For iRow = LastRow To FirstDataRow Step -1

i = i + 1
If .Cells(iRow, ServiceGroupColumn).Value = .Cells(iRow - 1,
ServiceGroupColumn).Value Then
Else
On Error Resume Next

rowsToAdd = (40 - i) / 2

.Cells(iRow, ServiceGroupColumn).Offset(i /
2).Resize(rowsToAdd).EntireRow.Insert

If Err.Number < 0 Then
MsgBox Err.Description, vbCritical
End If

i = 1
End If

Next iRow

End With

End Sub

 
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
Checking a date/number between two others [email protected] Excel Discussion (Misc queries) 6 March 31st 09 12:01 AM
number checking diam Excel Discussion (Misc queries) 0 November 29th 06 05:46 PM
number checking diam Excel Discussion (Misc queries) 0 November 29th 06 05:35 PM
Checking cell for Number Lee New Users to Excel 2 October 11th 05 09:23 PM
Checking if value is a number jonx - ExcelForums.com Excel Programming 2 September 24th 04 08:34 PM


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