Re: creating sequential rows
- From: OssieMac <OssieMac@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 21 Feb 2009 14:58:00 -0800
The code works perfectly with the sample data you posted and it produces a
result identical to the desired result you posted so we need to establish
what the problem is.
Error 448 suggests that you are calling the sub routine from another sub and
that you are trying to pass a parameter to it.
The code that I provided is not desiged to accept a parameter. If this is
what you are doing then post the sample of code you are using to call the
subroutine and let me know what the value of parameter is that you are trying
to pass to it.
Your quote: "Actually, if it would be easier, I can also fix the range to
compare the one column to. Say 240230 is the min and 240249 is the max."
Just edit the following two lines of code for whatever start and finish
values you require.
lngMinValue = 240229
lngMaxValue = 240241
Your quote: "What I need is a loop that goes through and will insert rows
and also should add the missing number."
The code does this. Inserts lines plus the missing number.
--
Regards,
OssieMac
"PVT" wrote:
Actually, if it would be easier, I can also fix the range to compare.
the one column to. Say 240230 is the min and 240249 is the max.
Each branch will have 240230 as its first number.
What I need is a loop that goes through and will insert rows and also
should add the missing number.
Something like:
1. Find first occurrence of 240230
2. Go to row below.
- If number equals 240231, go to next row.
- If number > 240231, insert a row and insert the number 240231 in
column A. Start over at 240230.
3. Loop through list until 240249 is reached
4. Find second occurrence of 240230
etc
There will be a maximum of 15 occurrences of 240230 for the 15
branches.
The desired end result is still the same as in the first post.
I realize this is probably real basic VBA but I am struggling so any
help is greatly appreciated!
- Follow-Ups:
- Re: creating sequential rows
- From: PVT
- Re: creating sequential rows
- References:
- creating sequential rows
- From: PVT
- RE: creating sequential rows
- From: OssieMac
- Re: creating sequential rows
- From: PVT
- Re: creating sequential rows
- From: PVT
- creating sequential rows
- Prev by Date: Re: How do I add the ability to select the number of printed pages to a Dialog ***
- Next by Date: Re: Screen alerts
- Previous by thread: Re: creating sequential rows
- Next by thread: Re: creating sequential rows
- Index(es):