Link to home
Start Free TrialLog in
Avatar of akatz66
akatz66

asked on

IF ERROR VB CODE

Hi All,
    This is a pretty simple VB question, but am a true beginner.  I made drop down menu which, when selected, will update two pivot tables. My report page points to information directly on the pivot, so when the date is changed, so does the report.  The problem I'm having is with dates that have no information on the pivot tables. Right now,  I have to index the dates in a lookup (i.e. for January I have to make a list of all the dates in January in consecutive rows.  This lookup is what populates the dates in the drop down menu.  Unfortunately, when there is no data for that date, it asks the user to set that date's information as the next one.  I definitely do not want that.  I want to code it so that if the date had no data, it would tell the user this and ask them to select another date.  The only VB code I am using is basically to change the filter on the date of two pivot tables to whatever the drop-down menu says.  The code says:

Sub updatePivot()
    [FilDate] = [selDate]
    [FilDate2] = [selDate]
End Sub

So i named the date filter for each pivot fildate and fildate 2 while the seldate is the output from the combo box.  So when I change the date on the drop-down menu to 1/22/2012, the seldate would also be 1/22/2012, which would change the fildates to the same date.  I'm just trying to make my work easier, so I can just copy a month's dates for my date lookup.  Currently, I have to run a separate pivot table, write down manually what dates don't have information, and then manually omit them from my index lookup.  Please help.
ASKER CERTIFIED SOLUTION
Avatar of StellanRosengren
StellanRosengren
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial