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
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
If everything else is independent of these two lines then maybe just ignore the error?
VBA Code:
On Error Resume Next
ActiveSheet.ListObjects("Table_pastel_12_cust_rank").ListColumns(40). _
TotalsCalculation = xlTotalsCalculationSum

ActiveSheet.ListObjects("Table_pastel_12_cust_rank").ListColumns(41). _
TotalsCalculation = xlTotalsCalculationSum
On Error Goto 0

GHope that helps.
 
Upvote 0
Cross posted
While we do allow Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules). This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.

Please supply links to all sites where you have asked this question.
 
Upvote 0
AAAHHHHHH - did not know the 2 sites are connected, different usernames in the 2, thats why. Now I know.
 
Upvote 0
They are not linked & you have already been made aware of this rule on at least three different sites in the past. So there is no excuse.
Please supply all relevant links.
 
Upvote 0
Fluff calm down. geesh. cant remember its mr excell and o ja. here it is.


how is excelforum and mrexcel linked? i do not understand this at all?
 
Upvote 0
You have (yet again) posted the same question to more than one site, without supplying links. If you do not understand what cross posting means try reading this
 
Upvote 0
How about stop sending links to read and and and be a bit helpful as a moderator and explain n laimans terms?
 
Upvote 0

Forum statistics

Threads
1,214,805
Messages
6,121,664
Members
449,045
Latest member
Marcus05

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
Back
Top