Solved

Handling Multiple Error Possibilities

Posted on 2013-01-07
5
115 Views
Last Modified: 2013-01-23
I can't seem to remember how to do this. Please take a look at the attached workbook. Column D has numbers that designate the week in which each incident occurred. (Dates in Column N). The "SpinOffWeeks' macro would work fine except that not every week is accounted for. Week 16 is followed by Week 19, Week 19 is followed by Week 21, etc.

The macro as I have it now will handle the Week 16 error, but it bugs on the Week 19 error.

How do I handle the fact that the sought-after number for 'btm' isn't always i + 1?

Set top = Incidents.Columns("D:D").Find(What:=i, After:=[D4], LookIn:=xlValues)
Set btm = Incidents.Columns("D:D").Find(What:=i + 1, After:=[D4], LookIn:=xlValues).Offset(-1, 0)

Open in new window

I need something that will find the next number higher than i, whether it's i + 1 or i + 2 or i +7, etc.

Thanks for solving my day ruiner! Here's to a better tomorrow :- )

John
0
Comment
Question by:gabrielPennyback
  • 2
  • 2
5 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 38753499
File not found error
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 38754819
Just to be clear, what ssaqibh means is that you forgot to attach your workbook.
0
 
LVL 1

Author Comment

by:gabrielPennyback
ID: 38755903
That fits with the kind of day I had yesterday that I would forget to attach the workbook! :- )
XYZ-Converter-Demo.xlsm
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 38772361
Try

Set btm = top.Offset(WorksheetFunction.CountIf(Range("D:D"), i) - 1)
0
 
LVL 1

Author Closing Comment

by:gabrielPennyback
ID: 38812812
Thanks, ssaqibh. Sorry for doing one of my famous disappearing acts!
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question