What am i doing wrong? VBA

filarap

New Member
Joined
May 15, 2015
Messages
33
Hi all,

I have a subscript out of range error, but i cannot find the reason why.
Whatever i do or change, it still comes back. Debug shows me range selection as an error.
Can anyone assist me?



char1 = "'"
char2 = "/"
char3 = "-"
char4 = ","
char5 = "."
char6 = "ß"





Set rng1 = Worksheets("Sheet1").Range("B22:u120").CurrentRegion






For Each rng2 In rng1

....

Regards
Filarap
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Do you have a sheet called Sheet1?
 
Upvote 0
Sheet itself has different name, but i used the name sheet1 as it is designating that sheet in projects window.
I will guess that it cannot be used in that way?

Regards
 
Upvote 0
If your referring to the codename try
Code:
Set rng1 = Sheet1.Range("B22:u120").CurrentRegion
But that sheet has to be in the same workbook as the macro
 
Upvote 0
Thank you Fluff,

I tried both your suggestion and using sheet name instead and it works :)

Regards
 
Upvote 0
Glad you got it sorted & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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