Out of Range Question

tomgrandy

New Member
Joined
May 10, 2024
Messages
45
Office Version
  1. 365
Platform
  1. MacOS
This is the same macro that I've run on spreadsheets with 500 artifacts from a sale, but this particular one is being run on 68,000 rows of artifact sales and I'm getting an Out of Range error and I'm not sure why.

VBA Code:
Sub URLtoImage()
Dim i As Long
Dim c As Range
Dim tx As String
Dim va, ary

    Application.ScreenUpdating = False

va = Range("A3", Cells(Rows.Count, "A").End(xlUp))
tx = "http://ai-drupal-10:8888/sites/default/files/feeds/auctions/images/AUCTION_DATE/"
For i = 1 To UBound(va, 1)
    ary = Split(va(i, 1), "/")
    va(i, 1) = tx & ary(UBound(ary))
Next
Range("I3").Resize(UBound(va, 1), 1) = va
Range("J3").Resize(UBound(va, 1), 1) = va
Range("K3").Resize(UBound(va, 1), 1) = va
Range("L3").Resize(UBound(va, 1), 1) = va


    Application.ScreenUpdating = True
    
    MsgBox "URL to Image Macro complete!"
    
End Sub

Screenshot 2025-01-13 at 2.21.42 PM.png
Screenshot 2025-01-13 at 2.32.00 PM.png
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Which line of code is raising the error? When the error occurs, what are the values of all of the variables in that line of code?
 
Upvote 0
This is the line of code that is raising the error:

va(i, 1) = tx & ary(UBound(ary))

What I am unsure is if the va is referring to column i row 1. If so, that would not be correct as the true value begins on row 3.

Admitting to be a beginner here.

Thanks!
Tom
 
Upvote 0
If I only copy over 1,000 items, it runs like a charm with no errors.

What I don't want to do is create 68 separate spreadsheets to run the same macro on.

Is there a maximum number of rows built into Excel where a macro can only run up to?

Thanks!
Tom
 
Upvote 0
What do you want to return if a cell in column A is blank ?
Try this:

VBA Code:
For i = 1 To UBound(va, 1)
    If va(i, 1) <> "" Then
        ary = Split(va(i, 1), "/")
        va(i, 1) = tx & ary(UBound(ary))
    End If
Next
 
Upvote 0
Solution

Forum statistics

Threads
1,225,628
Messages
6,186,103
Members
453,337
Latest member
fiaz ahmad

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