Next Blank Cell in uncontinuous Range

robfo0

Active Member
Joined
Feb 19, 2002
Messages
281
Hi everyone,

I have a macro, and im trying to find the next blank cell in a row (to the right of C3), BUT the problem is sometimes C1 is blank, sometimes C2 is blank, and sometimes both are blank, but regardless i want to find the the next blank cell to the right of C3. I have this code (which finds the first blank cell, even if it is C1, or C2):

Workbooks("Sheet").Sheets("Contractor Data").Range("C3").End(xlToLeft).Offset(0,1) = "Test"

How can i do this?

Thanks :)
This message was edited by robfo0 on 2002-09-05 16:23
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Try:

ActiveSheet.Range(Cells(3, 3).End(xlToRight), Cells(3, 3).End(xlToRight)).Offset(0, 1) = "Test"
 
Upvote 0
I just tried that, but when it runs, i get a run time 1004 error: application-defined or object defined error. This is the exact line i have used:

Workbooks("aa Test.xls").Sheets("Contractor Data").Range(Cells(3, 3).End(xlToRight), Cells(3, 3).End(xlToRight)).Offset(0, 1) = "note"

any ideas? thanks
 
Upvote 0
Well, i figured out a way to do it, but i dont think its the most efficient. Using a counter i cant increase the offset:

TempCount=1
Do Until loop here...

Workbooks("aa Test.xls).Sheets("Contractor Data").Range("C3").Offset(0, TempCount) = "Note"
TempCount = TempCount + 1
Loop

I would appreciate it if anyone has a better solution. Thanks
 
Upvote 0
If you want to continue this thread with me, send me an email response. For some reason it's taking a long time to get through the posts.

You can email me @ larai@saturnee.com

Are you in this workbook when you are running the macro or are you running the code from a different workbook?
 
Upvote 0

Forum statistics

Threads
1,214,806
Messages
6,121,672
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