Select next blank cell to right..!

m0atz

Board Regular
Joined
Jul 17, 2008
Messages
247
this really cant be that hard, however i'm having one of those days..

Part of my code is as follows;

Code:
        Cells(found.Row, 28).Select 
        
        'code not working correctly!!
        If ActiveCell.Value <> "" Then
        Selection.End(xlToRight).Select
        End If
        MsgBox ActiveCell.Address

There is a row of dates 15 cols wide, the start of which is in col 28. If there is a date already in this cell I just need to select the cell next to it (however my attempt at selection.end(xltoright).select hasnt worked because there are columns after this block of 15 with other data in it). If the cell is blank, i just need to select it.

Surely this is easier than I think it is..!! :)
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
You shouldn't need to select cells to work with them but this should do what you want:

Code:
For i = 1 To 15
    If Selection.Offset(, i).Value = "" Then
        Selection.Offset(, i).Select
        Exit For
    End If
Next i
MsgBox ActiveCell.Address
 
Upvote 0
That code works if there is a value in that cell, however if its blank it still jumps a cell to the right, can it the activecell just be selected in the instance?

(reason for the cells being selected at this stage is to ensure the right cell is being referenced to throw data in from userform at later stage)

Cheers
 
Upvote 0
wait - got it, changed from 1 to 15 into 0 to 15 and this looks at the activecell value.

thanks for your help VoG - as ever much appreciated.
 
Upvote 0

Forum statistics

Threads
1,214,840
Messages
6,121,895
Members
449,058
Latest member
Guy Boot

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