Hi All,
I am having a hard time trying to make my code find the first blank offset cell and only entering data to that first blank cell. So in this case, I want the data to be only entered in B1 because that is the first blank offset cell to column A. But what I'm having issues with is that it would also enter it to B3 or any offset cell to column A that has data in it. Any Help will be appreciated!
<tbody>
</tbody>
This is my code:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;">PrivateSub CommandButton1_Click()
Dim iRow As Range
Dim i AsLong
Dim ws As Worksheet
Set ws = Worksheets("RewinderData")
Set iRow = Range("A1:B10")
ForEach cell In iRow
If cell.Value <>""And cell.Offset(0,1).Value =""Then
cell.Offset(0,1).Value =Me.textbox_quantity.Value
EndIf
Next</code>
I am having a hard time trying to make my code find the first blank offset cell and only entering data to that first blank cell. So in this case, I want the data to be only entered in B1 because that is the first blank offset cell to column A. But what I'm having issues with is that it would also enter it to B3 or any offset cell to column A that has data in it. Any Help will be appreciated!
A | B | C | |
1 | 4555 | ||
2 | |||
3 | 4556 | ||
4 |
<tbody>
</tbody>
This is my code:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;">PrivateSub CommandButton1_Click()
Dim iRow As Range
Dim i AsLong
Dim ws As Worksheet
Set ws = Worksheets("RewinderData")
Set iRow = Range("A1:B10")
ForEach cell In iRow
If cell.Value <>""And cell.Offset(0,1).Value =""Then
cell.Offset(0,1).Value =Me.textbox_quantity.Value
EndIf
Next</code>