Subscript out of range

pvzshark

Repeated rules violations
Joined
Feb 26, 2020
Messages
23
Office Version
  1. 2013
Platform
  1. Windows
Good day all. I am getting an error subscript out of range. I know why i am getting it, I just need your help to bypass it.

I am importing data from mysql. Financial year vs last year financial year. but being in April the may, June July etc months does not exist for this year so i need to ignore it.
Below is wehre i do calculations for the columns 40 and 41. but they do not exist with this import but might for a future import. How do i if exist then else ignore?

VBA Code:
ActiveSheet.ListObjects("Table_pastel_12_cust_rank").ListColumns(40). _
TotalsCalculation = xlTotalsCalculationSum

ActiveSheet.ListObjects("Table_pastel_12_cust_rank").ListColumns(41). _
TotalsCalculation = xlTotalsCalculationSum
 

pvzshark

Repeated rules violations
Joined
Feb 26, 2020
Messages
23
Office Version
  1. 2013
Platform
  1. Windows
Wel no I get it, geesh ffs. so when post on another forum just add link from this one. easy as pie. now fluff, do you know vba?
 
Last edited by a moderator:

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,883
Office Version
  1. 365
Platform
  1. Windows
I would strongly suggest you take the time to read the rules of this, as you obviously haven't bothered to do so yet. This includes insulting other people.
 

pvzshark

Repeated rules violations
Joined
Feb 26, 2020
Messages
23
Office Version
  1. 2013
Platform
  1. Windows
Again fluff. Do you know vba at all? will you be able to help here, or are you just gonna fill this post with bad remarks? if you do know vba please help. how do I
in stead of just resume next, hide the column as well? If you do not know how to answer let me know and I will stop asking you. Maybee get someone who might be able to answer?

VBA Code:
On Error Resume Next
ActiveSheet.ListObjects("Table_pastel_12_cust_rank").ListColumns(35). _
TotalsCalculation = xlTotalsCalculationSum
On Error Resume Next
ActiveSheet.ListObjects("Table_pastel_12_cust_rank").ListColumns(36). _
TotalsCalculation = xlTotalsCalculationSum
On Error Resume Next
 

pvzshark

Repeated rules violations
Joined
Feb 26, 2020
Messages
23
Office Version
  1. 2013
Platform
  1. Windows
Fluff just does not like me because the springboks took the world cup. lol. Sorry I had to. lol
 

Watch MrExcel Video

Forum statistics

Threads
1,130,171
Messages
5,640,579
Members
417,151
Latest member
ChickenTenderer

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top