VBA error on selecting a whole column A1:A

PAULLYSTEW

New Member
Joined
May 8, 2019
Messages
5
I was sent a workbook that had macros selecting columns of varying length. The debugger showed me it did not like the selection (A1:A)
Once I changed it to (A1:A1000) far more cells than I'll ever populate, the macro works fine.

The question is why does my Office 2016 not like it but many others who got the same file have no issues?
Is there a parameter I can change on my system to allow this type of alliteration?
 
The code shouldn't stop, you should just get a #Name error in the cells.

Do you get the correct result with

Code:
    Range("I1").Formula = "=SUM(F:F)/I2"
    Range("I1").NumberFormat = "#,##0"
    With Range("I2")
        .NumberFormat = "0.0"
        .Formula = "=SUM(G:G)"
    End With
 
Last edited:
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
One possibility. Are you sure this macro runs on Excel? I have seen the A2:A syntax used on Google Sheets, but it's not Excel standard. I don't know if VBA can run on Google sheets though.
 
Upvote 0
I don't know if VBA can run on Google sheets though.

Hi Eric, Google sheets uses Google Apps Script which is based on Java not VBA.
You can sort of get around it by using something like GSpread.NET (only played with it a bit on my friends computer... she hasn't managed to convert me to the darkside yet).
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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