ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Basic Error Checking in Excel VB (https://www.excelbanter.com/excel-programming/336407-basic-error-checking-excel-vbulletin.html)

RestlessAde

Basic Error Checking in Excel VB
 
Hi,

I'm running the code:

ActiveSheet.PivotTables("PTMonthlyAnalystSalesSA") .PivotFields("SA").CurrentPage = ActiveSheet.Range("B1").Value

However, occassionally the value in B1 does not exist in the Pivot Table
field "SA" and I get a run time error. I'm not sure how to insert a basic
error checking routine that inserts the value "(blank)" into the
PivotField("SA") when an error occurs.

Any advice would be much appreciated.

Thanks,
Ra


RestlessAde

Basic Error Checking in Excel VB
 
I managed to work this out. For reference:

On Error resume next
you input routine

If Err then mydate = Listbox1.value
on Error goto 0

RA

"RestlessAde" wrote:

Hi,

I'm running the code:

ActiveSheet.PivotTables("PTMonthlyAnalystSalesSA") .PivotFields("SA").CurrentPage = ActiveSheet.Range("B1").Value

However, occassionally the value in B1 does not exist in the Pivot Table
field "SA" and I get a run time error. I'm not sure how to insert a basic
error checking routine that inserts the value "(blank)" into the
PivotField("SA") when an error occurs.

Any advice would be much appreciated.

Thanks,
Ra



All times are GMT +1. The time now is 02:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com