[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Handling Multiple Error Possibilities

Posted on 2013-01-07
5
Medium Priority
?
122 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 43

Expert Comment

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

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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

649 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