First blank cell inside a For Each loop

Smoken55

New Member
Joined
Aug 30, 2018
Messages
7
Hi All,
I have a list of users in a table. The appropriate User is found by using a For Each loop (this is working). Now, once the User is found, I have the row (that the User is in). I now need to find the first available/emply cell to the right, in this row. I need to search for the next available cell in this row because a new date ("stamp") will be placed in this row each day. Ultimately, I will have a whole row of dates to the right of each user.
I have explored a number of options to do this... but can't figure it out.

VBA code:
Set rng = Worksheets("sheet1").Range("I4:I21") 'This is the table of users.
irow = 4 'First row of Users
icol = 9 'The Column where the User is identified. The User Table never changes. Every date will be somewhere to the right of this Column.
For Each cell In rng
'Find the Row containing the user's NUID
If cell.Value = NUID Then
'find the first empty cell in this Row to the right.
'Cells(irow, Range("??").End(xlToRight).Column + 1).Select

'LastBlnkCol = Cells(irow, icol)

' Do Until IsEmpty(ActiveCell) = True

' ActiveCell.Offset(irow, 9).Select
'r = r + 1

'Loop
'LastBlnkCol = Cells(irow, icol.Count).End(xlToLeft).Column + 1
'range(

'
Enter the date.
Selection = stamp
End If
irow = irow + 1

Next cell


Any help is greatly appreciated!
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Try this.
Code:
Cells(cell.Row, Columns.Count).End(xlToLeft).Offset(,1).Value = stamp
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

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