excel VBA to select specific rows

D

dodong

I have created a userform in excel VBA use as a data entry form and I
have created this VBA code:

iRow = ws.Cells(Rows.Count, 3).End(xlUp).Offset(1, 0).Row

ws.Cells(iRow, 3) = TextBox1.Value

My problem is how to set this code to start the data from row 10 and
column 3, because currently it start from raw 2 and column 3.

Thanks very much for the help.
 
D

dodong

ws.Cells(10, 3) = TextBox1.Value

--
Regards









- Show quoted text -

Thanks for your quick reply. However, when I try to change with iRow
with 10 it overwrite the first data tha I entered. I need it to loop.
 
D

Dave Peterson

I'd qualify the Rows.count, too.

with ws
iRow = .Cells(.Rows.Count, 3).End(xlUp).Offset(1, 0).Row
if irow < 10 then
irow = 10
end if
.cells(irow,3).value = textbox1.value
end with
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top