Vba Code to Select Range with blanks

SharmaAntriksh

New Member
Joined
Nov 8, 2017
Messages
31
I have a dataset where i am trying to select a range but there are a lot of blank cells in between and each time i run

range("a2345:c3345").end(xlup).select

It stops at the first blank

I came up with a temporary workaround for this by looping this code

Sub SelectRange()

For x = 1 to 300

range("a2345:c3345").end(xlup).select

Next x

End sub

The only problem is once the data set gets bigger the loop value of x =300 will stop in between, i want to be able to get to the range Range("a1:c1") without looping while selecting data from a2345:c2345

Let me know if there is a solution for this. Thank you
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Is there a specific column that will always have the last row of data?
 
Upvote 0
So the range A1:C1 will always have the last row of data, so the last row of data will always be 1?:eek:
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

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